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

Why wont this print? To my understanding there is nothing wrong with this, I have no console errors

I have a script that sets the time to 19, and it works, but then this doesn't go through?

if game.Lighting.TimeOfDay == 19 then 
   print("19")
end

1 answer

The reason it is not printing anything is because the if statement is not within a loop. What you can do is use OnChanged() to detect when the time changes, and when it changes, it checks the TimeOfDay and sees if it is 19.

game.Lighting.Changed:Connect(function(changedProperty) --Lighting property is changed
	if game.Lighting.TimeOfDay == 19 then 
		print("19")
	end
end)

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