I've been looking around for an event that fires every time os.time() changes. I'd prefer to not just have a 1 second loop that is off sync with the actual os.time(). Thanks in advance for any advice C:
COMMUNITY QUESTION
os.time() changed event? [NOT SOLVED]
1 answer
You can only find out by testing it out yourself. The only way I can think of executing code after os.time() increments is by checking the difference between the current time and the last. Test it out and compare it to waiting one second.
local tock = os.time()
spawn(function()
while wait(1) do
print(0/0)
end;
end)
while true do
if os.difftime(os.time(), tock) > 0 then
warn(0/0);
tock = os.time();
wait"";
end;
end;
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Sadly, I do not think you can use something like the '.Changed' event to detect if the time has changed; You may have to use a Loop that loops every Millisecond. :(