Trying to make fog using a script

So I am trying to make fog using a script so I can make storms and things like that but I have no idea why this script won’t work. It is a local script and all the parents for the lighting are correct I think, I tried it as a script and it doesn’t work, the script below is just for constant fog but I also have one for storms which just has wait in it.

local lighting = game.Lighting
local fogend = lighting.FogEnd
local fogstart = lighting.FogStart
local fogcolour = lighting.FogColor

local interval = 1

while wait (interval) do
	fogend = 200
	fogstart = 0
	fogcolour = Color3.new(0.709804, 0.709804, 0.709804)
end

image

You need to reference the property directly, the way you’re doing will not work as it doesn’t reference the property, but rather a variable, try this out

local lighting = game:GetService("Lighting")

local interval = 1

while wait(interval) do
	lighting.FogEnd = 200
	lighting.FogStart = 0
	lighting.FogColor = Color3.new(0.709804, 0.709804, 0.709804)
end
1 Like

It worked thanks, it needed to be in a normal script but works now.

1 Like

Anytime! I would recommend marking my psot as the solution if you haven’t already so others would know this post has been solved!!

If you have anymore issues don’t be afraid to make another post!

Thanks again and thanks for reminding me to put the post as solved.

1 Like