Cool number spinning effect

In celebration of Roblox going public, I’ve recreated a certain broker-dealer’s stock price number spinning effect because I thought it was cool.

Open sourced place file: StockPrice.rbxl (30.5 KB)

Edit: You can change the wait loop at the end to update every wait() for it to be more responsive, it still works.

Double edit: If you want to use this for yourself, use @boatbomber’s module he created!


All I can say is that it looks cool, and nothing else.
maybe boatbomber would use this in their realtime updating roblox stock thing

1 Like

That’s so well made. The fact you got the numbers to move is cool enough on its own. maybe you can use this in a game and it could update to the RAP of a limited in real time.

1 Like

It’s a pretty neat effect and is useful as reference for other types of systems where you want to animate numbers rather than just typewriting or putting a static event. Thanks for sharing.

There is some feedback I’d like to offer. Still understanding that this isn’t exactly a dedicated and full model and rather something just rough to demonstrate an effect, I feel like it’s still applicable.

  • Don’t use delay. Subject to frequent discussion lately spawn, delay and wait are bad. You should settle for event-based solutions where possible. In this case, what you should be using instead is Tween.Completed. The delay is clearly used here to run functions after the tween finishes but an event already exists to properly do that and so it should be used.

  • Use ipairs over pairs when working with contiguous arrays (e.g. GetChildren). Child ordering doesn’t matter in this scenario but ideally and canonically it’s better to use ipairs to go through arrays. I am unsure of the speed difference but I’d imagine a known order is faster to iterate than arbitrary order (index versus next function).

  • Consider using variables to store TweenInfos that are used multiple times rather than creating a new TweenInfo object every time a tween needs to be made, provided you’re going for a consistent feel. I notice that there’s a lot of TweenInfos being created that are just the same as another, so these can just be reused instead of created per tween.

In any case: cool stuff!