So. What I am trying to do is if the time is in-between "17:00:00" and "04:00:00" (game time) then the lights are turned on, but what I am also trying to do is change the material of the light itself.
while wait() do if game.Lighting.TimeOfDay >= "17:00:00" and game.Lighting.TimeOfDay <= "06:00:00" then script.Parent.PointLight.Enabled = true script.Parent.Material = Enum.Material.Neon else script.Parent.PointLight.Enabled = false script.Parent.Material = Enum.Material.Plastic end end
Using the built in function of Lighting, GetMinutesAfterMidnight(), you an find the minutes after midnight (as the function's name suggests...). You can then check it's between 360 (06:00:00 - found by using the example on the wiki page) and 1020 (17:00:00 - found by using the example on the wiki page). You may also want to use game.Lighting.Changed instead of a forever loop as it's more efficient. Your final code would be this:
function changeLight() local tam = game.Lighting:GetMinutesAfterMidnight() if tam <= 1020 and tam >= 360 then -- If it's between 06:00:00 and 17:00:00 script.Parent.PointLight.Enabled = false script.Parent.Material = Enum.Material.Plastic else script.Parent.PointLight.Enabled = true script.Parent.Material = Enum.Material.Neon end end game.Lighting.Changed:connect(function() changeLight() end) changeLight() -- Run to get initial status