local rotationMinutes = 5 * 60
--math.ceil(os.time() / rotationMinutes)
-- seed changes every 5 minutes
I need a way when a new server is created, that the timer will be until the next seed change. I don’t want to use any long modules or datastores for this. I tried looking up how I would be able to sync this code efficiently, but found no results.
I made a way that uses data stores, but I figured there should be a way with some math to calculate each item and the time until the next item without datastores or https service.
I am using this for a shop that changes every 5 minutes, preferably without any long functions and just some math. If you are able to help that would be appreciated!
TLDR: I need some math to calculate how long until the next seed change
yeah, server os.time is the same for all servers, the code would be as simple as getting the time until the next 5 minute mark, which is simple, since the value could never be higher than 5.
I tried using it but it returns -1, I found another way. Thanks for your help though
local rotationMinutes = 5 * 60
while task.wait(1) do
local nextTime = math.ceil(os.time() / rotationMinutes)
print(math.round((math.ceil(os.time() / rotationMinutes) - os.time() / rotationMinutes) * rotationMinutes))
end