I have a text mesh in my game that's outside on the water, and what I've noticed is that you can't see the black color when it's night, but you can see the white color when it's night. Here's what I have with my script so far, but yet again, it's probably wrong. If anyone could make a thing that when it's day - make the block black and when it's night - make the block white. Thanks!
My faulty code:
script.Parent.Name = "LightPart" lightPart = game.Workspace.LightPart minutesAfterMidnight = 0 while true do minutesAfterMidnight = minutesAfterMidnight + 10 game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(0.1) if game.Lighting:GetMinutesAfterMidnight() == 6 * 60 then -- checks for 6AM lightPart.BrickColor = BrickColor.new(Color3.new(1, 1, 1)) lightPart.PointLight.Enabled = false end if game.Lighting:GetMinutesAfterMidnight() == 18 * 60 then -- checks for 6PM lightPart.BrickColor = BrickColor.new(Color3.new(255, 255, 255)) lightPart.PointLight.Enabled = true end end
Your script works perfectly, its just something weird with the colors. Since Color3 for parts is rather new I don't know much about it. But anyway, I wrote this:
script.Parent.Name = "LightPart" local lightPart = game.Workspace.LightPart local minutesAfterMidnight = 0 while true do minutesAfterMidnight = minutesAfterMidnight + 10 if minutesAfterMidnight == 24 * 60 then minutesAfterMidnight = 0 end game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight) wait(0.1) if minutesAfterMidnight == 6 * 60 then -- checks for 6AM lightPart.BrickColor = BrickColor.new("Really black") lightPart.PointLight.Enabled = false elseif minutesAfterMidnight == 18 * 60 then -- checks for 6PM lightPart.BrickColor = BrickColor.new("Institutional white") lightPart.PointLight.Enabled = true end end
I just thought it would be a little more efficient using the minutesAfterMidnight variable instead of :GetMinutesAfterMidnight()
every time. :)