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

How do I change the fog color from a script?

Asked by 6 years ago

I have this : function onTouched(hit) game.Lighting.FogColor = "Bright red" game.Lighting.FogEnd = 100 end script.Parent.Touched:connect(onTouched)

2 answers

Log in to vote
1
Answered by 6 years ago
local CustomColor = -- put the color here, RGB or the name
local fog = game.Lighting.Fog -- the fog
local part = script.Parent -- the part getting touched

part.Touched:connect(function() -- when part touched..
    fog.Color = CustomColor -- change to fog color
end -- change this to end) if it won't work :P

Try this, It may not work but that's the best i can do, feel free to accept answer if it works, thanks, by greatneil80 :)

0
it needs to be end) abnotaddable 920 — 6y
Ad
Log in to vote
1
Answered by
2eggnog 981 Moderation Voter
6 years ago

The fog color is a Color3 value, not a BrickColor. Adding this to your script, we get:

function onTouched(hit)
    game.Lighting.FogColor = Color3.new(1, 0, 0) --This will set the fog to red.
    game.Lighting.FogEnd = 100
end
script.Parent.Touched:connect(onTouched)

Answer this question