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

Why is this for loop not working?

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

✓ Accepted answer
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)

This discussion is preserved as it was. New answers, comments, and votes are closed.