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

Ambient and OutdoorAmbient setting in Lighting set by scripts is 255 times intended value!?

Tried this:

l = game:GetService("Lighting") t = script.Parent.DayType function identify() print(l.Ambient,t.Value)

if t.Value == "cold" then
	l.Ambient = Color3.new(162, 197, 223)
	
elseif t.Value == "cool" then
	l.Ambient = Color3.new(194, 208, 223)
	
elseif t.Value == "nice" then
	l.Ambient = Color3.new(189, 189, 189)
	
elseif t.Value == "warm" then
	l.Ambient = Color3.new(165, 163, 137)
	
elseif t.Value == "hot" then
	l.Ambient = Color3.new(118, 114, 0)
	
else print("Wut? Unkown daytype???")
end

end while wait(3) do identify() end

And got 255 times the color3 values i put in, reading as negative halves, and making the game either blinding white or empty void.

1 answer

If you want to get the correct value, you would have to divide the number you want by 255, according to the ROBLOX Wiki. http://wiki.roblox.com/index.php?title=Color3

Under 'Useful Code'

if t.Value == "cold" then
    l.Ambient = Color3.new(162/255, 197/255, 223/255)

elseif t.Value == "cool" then
    l.Ambient = Color3.new(194/255, 208/255, 223/255)

elseif t.Value == "nice" then
    l.Ambient = Color3.new(189/255, 189/255, 189/255)

elseif t.Value == "warm" then
    l.Ambient = Color3.new(165/255, 163/255, 137/255)

elseif t.Value == "hot" then
    l.Ambient = Color3.new(118/255, 114/255, 0)

else print("Wut? Unkown daytype???")
end

NOTE** There is a much better way than just doing it this way, instead of individually dividing everything by 255. Also, note that 0 does not have to be divided by 255, same with 1.

2 comments

0

TY very much, this was extremely confusing, and making me think my computer was dying.

0

Haha, you're welcome. It was confusing for me first.

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