What I'm trying to do is I want the material to change its appearance from smooth plastic to neon when it is turn to night time. How can I do that? I don't know how to fix it and I need you guys to help me out.
--This script turns the light on at night and off in in the day! b = script.Parent local oh,om = 6,20 -- Open Time (hours,minutes) local ch,cm = 17,45 -- Close Time (hours, minutes) local l = game:service("Lighting") if (om == nil) then om = 0 end if (cm == nil) then cm = 0 end function TimeChanged() local ot = (oh + (om/60)) * 60 local ct = (ch + (cm/60)) * 60 if (ot < ct) then if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then b.Enabled = false else b.Enabled = true end elseif (ot > ct) then if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then b.Enabled = false else b.Enabled = true end end end TimeChanged() game.Lighting.Changed:connect(function(property) if (property == "TimeOfDay") then TimeChanged() end end)
Many thanks, my friends!
try adding
if game.Lighting.TimeOfDay == 000000 then game.Workspace.Part2.Material = "Neon" end