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

Why is this for loop not working?

Asked by 10 years ago

I have the Lighting set at 14:00:00 and when a person enters the game the time goes by this script:

game.Players.PlayerAdded:connect(function(plr)
    while true do
        wait(.5)
        for i = 16.11,16.25 do
            game.Lighting.TimeOfDay = i
            wait(0.5)
        end
    end
end)

The Lighting goes to 16:11:00 and stays there . Why? Please Help!! THANKS!!!!!

1 answer

Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
10 years ago
game.Players.PlayerAdded:connect(function(plr)
    while true do
        wait(.5)
        for i = 16.11,16.25,.01 do -- Added .01, since you can't go from this specific number to 16.25 without specifying an increment.  
            game.Lighting.TimeOfDay = i
            wait(0.5)
        end
    end
end)

Ad

Answer this question