So I want to make a timer which still goes on when players leave the game, and I want it to wait 1 week and then update a decal on a part. I would assume I would have to use something like os.time()
?
PS: This is for a weekly fan art type of thing
So I want to make a timer which still goes on when players leave the game, and I want it to wait 1 week and then update a decal on a part. I would assume I would have to use something like os.time()
?
PS: This is for a weekly fan art type of thing
function changedecal() -- Whatever function you want to name it
-- Change decal
end
wait(604800 - os.time()%604800)
changedecal()
while wait(604800) do
changedecal()
end
I think this should work fine. 604800 is equal to one week in secs. And yeh, your on the right track. You going to need to use os.time
Thanks so much, would this work even if the player isnât in the server/
Is this play time or real time?
Itâs real time, I want it to change every week even when the player isnât in the server.
Whatâs the modulus for? Why do you have to return teh remainder? Iâm confused.
No, I mean: This script right now: Would not run real time.
this wouldnt run when the server ends so the server would still have to run for a week for this manner to change the decal
@FerbZides OP never specified he wanted it to run it synchronised on the server.
@Ulxqra os.time returns the clients time, so it returns the real life time from the clientâs machine
@xxIamInevitable I didnât return the remainder? Iâm subtracting the clients time until a week has passed and calling that function
If you want it to run it on the server and not have it reset, your best bet is grab an arbitrary date thatâs valid to calculate the time from.
Itâs a bit confusing but I suggest you do some research, here are few links:
The percentage is called âmodulusâ, which is basically division, but it instead returns the remainder.
wait(604800 - ostime()%604800)
I think this will work:
while true do
if os.time("%A") == "43" then
decalweek43.Parent = display
elseif os.time("%A") == "44" then
decalweek44.Parent = display
end
wait(0.1)
end