Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this workspace script want to work at all?

Asked by
2_MMZ 1059 Moderation Voter
3 years ago

Hello, I have a game where the time changes. (It works properly. The text and time changes.) I have a workspace script that checks every 0.9 seconds if the time was a certain time, and upon running this script, it did not work at all. No prints. Can anyone help me with this?

Code:

while true do
    wait(0.9)
    if game.Lighting.ClockTime == 10.033 then
        print("its 10")
    end
end

--i deleted the whole script to test this and it STILL doesnt work??

Any WORKING answer is appreciated!

0
i think i might have fixed it idk Jakob_Cashy 79 — 3y
0
dawg, that precision aint it bro. sometimes it will skip over 10.033 and go to maybe 10.045. debug it to the best of your ability, and make a range that you are certain will make it print 10. For example, if clocktime > 9.5 and clocktime < 10.5 or something greatneil80 2647 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago
game.Lighting:GetPropertyChangedSignal("Time"):Connect(function()
    if game.Lighting.Time >= 10 and <= 10.5 then --gives an estimation of time, can be changed

    --code
end)
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
while true do
    wait()
    if game.Lighting.ClockTime == 10 then
        print("its 10 XD")
    end
end

the wait(0.9) is messing it up

0
It isn't 2_MMZ 1059 — 3y

Answer this question