Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

os.time() changed event? [NOT SOLVED]

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:

1 comment

1

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. :(

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.