Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Lighting Glitch, help?

screen goes black like nighttime, and then when set to daytime, goes solid white, not normal like it should.

while true do
	wait(300)
	game.Lighting.Brightness = 0
	game.Lighting.TimeOfDay = "2:00:00"
	game.Lighting.Ambient = Color3.new(0,0,0)
	for _,v in pairs(workspace:GetChildren())do
		if v.Name == "Lantern" then
			v.PointLight.Enabled = true
		end
	end
		wait(300)
	game.Lighting.Brightness = 1
	game.Lighting.TimeOfDay = "12:00:00"
	game.Lighting.Ambient = Color3.new(128,128,128)
	for _,v in pairs(workspace:GetChildren())do
		if v.Name == "Lantern" then
			v.PointLight.Enabled = false
		end
	end
end

1 comment

0

With the Color3.new(128,128,128) You need to divide it by 255. Anything like that, divide it by 255.

1 answer

✓ Accepted answer

Well, I'm bad at explaining the why, but here's the how:

while true do
    wait(300)
    game.Lighting.Brightness = 0
    game.Lighting.TimeOfDay = "2:00:00"
    game.Lighting.Ambient = Color3.new(0,0,0)
    for _,v in pairs(workspace:GetChildren())do
        if v.Name == "Lantern" then
            v.PointLight.Enabled = true
        end
    end
        wait(300)
    game.Lighting.Brightness = 1
    game.Lighting.TimeOfDay = "12:00:00"
    game.Lighting.Ambient = Color3.new(128/255, 128/255, 128/255) -- Problem
    for _,v in pairs(workspace:GetChildren())do
        if v.Name == "Lantern" then
            v.PointLight.Enabled = false
        end
    end
end

Color3 values other than 0 and 255 have to be divided by 255 to work correctly, because they have to be between 0 and 1.

This discussion is preserved as it was. New answers, comments, and votes are closed.