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

Outdoor Ambient Doesnt change?

I am working on core freezedown and meltdown but The Outdoor Ambient value in Lighting doesnt change here is the script

while true do
temp = game.Workspace.Temp.Value
if temp == -300 then
script.Parent.Parent.Ice:Play()
script.Parent.Parent.Music:Play()
script.Parent.Parent.Alarm2:Play()
wait(5)
script.Parent.Parent.Power:Play()
wait(0.1)
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = 0, 0, 0 //here is the problem
elseif temp == -301 then
script.Parent.Parent.Ice:Play()
script.Parent.Parent.Music:Play()
script.Parent.Parent.Alarm2:Play()
wait(5)
script.Parent.Parent.Power:Play()
wait(0.1)
game.Lighting.Brightness = 0
game.Lighting.OutdoorAmbient = 0, 0, 0//here is it too
elseif temp == -302 then
script.Parent.Parent.No:Play()
elseif temp == -303 then
script.Parent.Parent.No:Play()
elseif temp == -304 then
script.Parent.Parent.No:Play()
else
script.Parent.Parent.No:Play()
end
wait()
end

3 comments

0

please put all of your code in the codeblock

0

posted it

0

This indentation deserves an award.

1 answer

✓ Accepted answer

Firstly, let's indent this code. It's a mess.

while true do
    temp = game.Workspace.Temp.Value

    if temp == -300 then
        script.Parent.Parent.Ice:Play()
        script.Parent.Parent.Music:Play()
        script.Parent.Parent.Alarm2:Play()
        wait(5)
        script.Parent.Parent.Power:Play()
        wait(0.1)
        game.Lighting.Brightness = 0
        game.Lighting.OutdoorAmbient = 0, 0, 0 //here is the problem
    elseif temp == -301 then
        script.Parent.Parent.Ice:Play()
        script.Parent.Parent.Music:Play()
        script.Parent.Parent.Alarm2:Play()
        wait(5)
        script.Parent.Parent.Power:Play()
        wait(0.1)
        game.Lighting.Brightness = 0
        game.Lighting.OutdoorAmbient = 0, 0, 0//here is it too
    elseif temp == -302 then
        script.Parent.Parent.No:Play()
    elseif temp == -303 then
        script.Parent.Parent.No:Play()
    elseif temp == -304 then
        script.Parent.Parent.No:Play()
    else
        script.Parent.Parent.No:Play()
    end
    wait()
end

Much better. We can now easily see the problem.


Remember that in assignment, additional results are discarded. So game.Lighting.OutdoorAmbient = 0, 0, 0 was not assigning OutdoorAmbient to black color, but instead to zero. The last two zeroes are discarded. You must use the Color3.fromRGB (or new) constructor to create a Color3.

game.Lighting.OutdoorAmbient = Color3.fromRGB(0, 0, 0)
-- # or game.Lighting.OutdoorAmbient = Color3.fromRGB() 
-- # since not passing any arguments will just return a color3 0, 0, 0

1 comment

0

Thanks for answering

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