I want to change the color of the brick according to the time of the day. But it doesn’t seem to be working.
part.BrickColor = BrickColor.new("Institutional white")
while true do
wait(0.1)
local timeoday = game.Lighting.ClockTime
if timeoday > 17.6 or timeoday < 6.4 then
part.BrickColor = BrickColor.new("Institutional white")
else
part.BrickColor = BrickColor.new("Really black")
end
part.BrickColor = BrickColor.new("Institutional white")
while true do
wait(0.1)
local timeoday = game.Lighting.ClockTime
if timeoday > 17.6 or timeoday < 6.4 then
part.BrickColor = BrickColor.new("Institutional white")
else
part.BrickColor = BrickColor.new("Really black")
end
end
This should be ok. Next time check the output for possible errors.
local part = script.Parent
while true do
wait(.1)
local timeoday = game.Lighting.ClockTime
if timeoday > 17.6 or timeoday < 6.4 then
script.parent.BrickColor = BrickColor.new("Institutional white")
else
script.parent.BrickColor = BrickColor.new("Really black")
end
end