Stock Market System

How would I make a stock market system for my game? For example changing prices each time. calculating the change. Using os.time I should be able to make the stock change each time I believe. I am kinda confused on what should I aim for though. Like should I use math.random 2 times? for example lets say I use math.random to tell weather its a positive change or negative change. After that how much of the change is their? Would this be easy to understand or it’s too complex for kids? and should there be a wide gap using math.random?

So os.time sounds like a decent way to seed it, though it may make more sense to seed it by the server’s current hour/minute instead of second. Also you might want to use the Random class instead of math.random for more consistent randomness.

You’d likely need two randoms, one to set the direction (pos or neg) and one for the actual amount it changes by.

For the actual change amount range, you could possibly even have a third random where it decides a small, medium, or large change - and seed it so that large changes are more rare.

Kids will roughly understand it, but a tutorial would help a lot. GTA V has a stock system and Roblox used to have a stock-like system via the currency exchange.

As far as I see it, because I tried doing this once didn’t get very far, but I understand it’s mechanics
You have 2 methods of doing it.

You have method one, where you use Math.Random to show the changing rate of stocks within a certain range and from that you can use decimal multipliers to change the value of the currency that’s within the stock market.

Or you have method two, in which you have some form of integration with a live update feed to copy the direct values of the current stock values.
This method would require integration with maybe trello, not sure but I am positive that it’s possible.

Explaining it to users may be a bit harder, but in essence as time changes so can the value of your money so you invest when it’s low and sell when it’s high.

Stay Safe and Stay Creative
Tom