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
2 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 — 2y
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 — 2y

2 answers

Log in to vote
1
Answered by 2 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 2 years ago
Edited 2 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 — 2y

Answer this question