FogEnd will not change

I have a very weird issue. In my game, I’m trying to change the FogEnd for a certain event. This event is controlled mainly by one script that branches into a few other smaller scripts. This works in studio, like a lot of other issues I have, it doesn’t work in a server… I get no errors in the console, client or server, so it is really confusing.

I’ve tried many things to attempt to make this work. I’ve tried making it a localscript, I’ve tried making a separate script that deals with it, I’ve tried putting a script in Lighting that changes it when the first script is activated, and I’ve checked for other scripts that might be affecting the FogEnd. None of these worked.
Also, I’ve looked all over the wiki, and other sources I could find. None of them provided any (working) answers.

Prior to this, I tried getting answers from ScriptingHelpers. One person replied, but after I replied back they didn’t respond…

This has put a halt to the production of my game, so thanks for the help in advance!

1 Like

Have you tried running the game and manually changing the FogEnd value to see if it’s being changed by a script?

1 Like

Yes. I can change it in studio, but when I try to do that in a server it wont change.

1 Like

I’ve also made sure no scripts are interfering with the FogEnd.

1 Like

Are you sure that the line is being executed? Put a print directly above it to ensure execution. Also you might want to post the code.

Posting your scripts would be helpful.

Try searching all the lines where the string “FogEnd” occurs (CTRL+F) and posting them here.

1 Like

I did that and it did print in both server and studio. The segment containing the FogEnd script is this:

lighting.FogColor = Color3.fromRGB(30, 0, 0)
script.LColor.Disabled = false
script.Fogend.Disabled = false
script.Amb.Disabled = false

The script it links to is this:

while wait(0.1) do
	print("fogend")
	game.Lighting.FogEnd = 45
end

I put it in a loop because I wanted to make sure it was executed.

1 Like

Any other scripts that modify FogEnd?

1 Like

Nope. I’ve checked multiple times.

Mind running this code somewhere? This just prints the FogEnd whenever it changes:

game.Lighting:GetPropertyChangedSignal("FogEnd"):Connect(function()
   print("New fog end: " .. game.Lighting.FogEnd)
end)

This should only print once. If it alternates between values then there’s something wrong.

1 Like

Maybe there is a script I missed… I don’t know, I’ll look again I guess.
image

1 Like

Ctrl+Shift+F (Search all scripts) → “FogEnd” !

I did that and none of them change it to 500.

1 Like

Are you using any “anti-exploit” scripts that automatically revert changes?

No.

1 Like

Try search all scripts for Lighting.Changed

No results.

1 Like

I figured it out! I can’t believe I didn’t think of this, but there was a setting in the admin i used that disabled changes to lighting. Sorry! It works now.

1 Like

Hi, recently I’ve run into the same issue. Did you ever figure out how to fix it?

1 Like

Yes, there’s a solution check mark right above your post. Check your code for items overwriting FogEnd or forcing values to the Lighting service.

4 Likes