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

How do I change the fog color from a script?

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

2 answers

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 :)

1 comment

0

it needs to be end)

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)

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