-- Turning On and off script Light = script.Parent.PointLight while wait() do if game.Lighting.TimeOfDay == "19:00:00" then Light.Enabled = true script.Parent.Material = "Neon" else if game.Lighting.TimeOfDay == "06:00:00" then Light.Enabled = false script.Parent.Material = "DiamondPlate" end end end
Is it just server lag or does the first if statement not work?
So I have this loop running in about 17 lamps in my game. All functioning in a regular script. Most simple job ever. Turn on at This and That time.
It turns off at 6:00:00, but it won't turn on at 19:00:00 UNIX time. Would a function work better in this situation?
Help?
Try using that script
lightPart = game.Workspace.LightPart minutesAfterMidnight = 0 while true do minutesAfterMidnight = minutesAfterMidnight + 10 -- Day/Night Cycle game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(1) if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then -- checks for 6AM lightPart.Material = Enum.Material.Plastic lightPart.PointLight.Enabled = false end if game.Lighting:GetMinutesAfterMidnight() == 19 * 60 then -- checks for 7PM lightPart.Material = Enum.Material.Neon lightPart.PointLight.Enabled = true end end