Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by
thePyxi 179
9 years ago

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.

0
TY very much, this was extremely confusing, and making me think my computer was dying. Iweigh200lbs2u 10 — 9y
0
Haha, you're welcome. It was confusing for me first. thePyxi 179 — 9y
Ad

Answer this question