Let's say you forego your $5 Starbucks just one day per week and put it into mutual funds. $5 * 52 weeks = $260 extra invested per year.
Let's say you keep doing that each year from the age of 20 until you turn 60. Assuming an average annual rate of return of 8%, that Starbucks money would be worth ~$73,000.
Even though you only put in $260 * 40 = $10,400 total over that 40 years. Just accumulated compound interest over time works out to that.
Do it for 10 more years (50 years total), and a $13k total investment will grow to $161k.
So I'd say it does more than nothing. You don't have to go nuts with it, but even just starting early and putting in money every month, will eventually add up to a lot more than you put in.
By the way, it doesn't HAVE to be a Starbucks coffee you forego, it could be anything, or just a certain amount set aside for the investment, it's just a common luxury that's easy to replace (make coffee for a tenth of that at home) and cheap enough for illustrative purposes, which is why they use it a lot as an example. Keep the Starbucks and eat out one less time per week, or buy one less video game per month, or whatever.
If you're poor and don't really have the room in your budget for $260 a year, do whatever you can afford. Even $60 a year ($5/month) would become ~$37k after 50 years (for only $3000 put in). And hopefully over time you can better your circumstances and afford to put in a little bit more.
Disclaimer: Assumes global stability, no WW3, no environmental devastation in 40 years, etc...which is starting to look less likely.
Site where I put those variables in for the calculation: https://www.capitalgroup.com/individual/planning/tools/inves...