I'm new to scripting and I need help with this fog script.
What this script is supposed to do is when the player is touching the part the fog will be less dense to its default. (300)
But when the player stops standing on the part the fog will become denser. (50)
The problem is that this script is doing nothing and not changing the FogEnd value. I see no errors on the output. (This is on a local script)
Any fix?
Fog = script.Parent
local function onTouch(otherPart)
local character = otherPart.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
Fog.Touched:Connect(onTouch)
game.Lighting.FogEnd = ("300")
Fog.TouchEnded:Connect(onTouch)
game.Lighting.FogEnd = ("50")
end
end
Also, how I make where the fog will transition between the values that way the fog won't be changed in an instant.
would I add
for i=1,10 do...
?

3 comments
look at where you are establishing your functions
what fogEnd?
You never call the function, and that's not how you connect to events either