#How to store random values in data storage?

1 messages · Page 1 of 1 (latest)

devout ember
#

While I was programming a tower defense game I came across the following problem, I wanted to make a screen of characters from this banner that updates every 10 minutes, like in All Stars Tower Defense, so I ended up thinking, there won't be just one server in a game, there will be several, so how would I save it if, for example, there are 10 servers sending a value to the same variable, and also, how would I update it at a certain time if the time for each server is different?

stiff root
nimble orbit
#

the time for each roblox server is, in fact, not different.

devout ember
# stiff root I don’t quite understand what you’re trying to do. I’ve no clue what you mean wi...

It's something like this: every x amount of time, the banner changes, and consequently, the appearance/characters of the banner also change (in this case, the rigs in this image). What I want to do is generate 3 random numbers every 10 minutes, like this: local Ran1
local Ran2
local Ran3

while true do
Ran1 = math.random(1, 100)
Ran2 = math.random(1, 100)
Ran3 = math.random(1, 100)
wait(600)
end
Then I want to save these values to DataStore. In another script, I would retrieve these random values and use them to get a character from a folder in ServerStorage.

The problem is, I can't think of a way to do this properly because of the issues mentioned: there will be multiple servers sending multiple values, and their timers won't be synchronized.

To put it simply, what I want to do is save and set random values to 3 different variables in DataStore (Sorry if my English is a bit bad, I used Google Translate to say what I wanted to say)

nimble orbit
#

use Random

devout ember
devout ember
sacred vaultBOT
#

studio** You are now Level 1! **studio