This code is in a server script and I want the part to change when It is night time. and metal material when it is day.
while true do
local timeofday = tonumber(game.Lighting.ClockTime)
if timeofday >= 18 or timeofday <= 6 then
game.Workspace.Part.Material = Enum.Material.Neon
elseif timeofday <= 18 and timeofday >= 6 then
game.Workspace.Part.Material = Enum.Material.Metal
end
wait()
end

3 comments
Not able to test currently but your code is trying to make the part 2 different material types at both 18 and 6, you need to change your elseif to <18 and >6.
when the time changes the material isnt changing
Could you be more descriptive of your issue