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?
#How to store random values in data storage?
1 messages · Page 1 of 1 (latest)
I don’t quite understand what you’re trying to do. I’ve no clue what you mean with a “screen of characters”, and to be frank, I’ve no interest in going through the painful process of updating roblox just to join a game for a minute, so sending a screenshot of what you mean would be appreciated
the time for each roblox server is, in fact, not different.
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)
use Random
What I meant is, how would I do a "Wait(x)" since each server could have been created at a different time?
use Random + store the seed in memorystore https://create.roblox.com/docs/reference/engine/datatypes/Random
I'll try and come back with the results, thanks for the idea :D
** You are now Level 1! **