I want to know when you touch a block the fog changes to x number But I don't know much about scripting Someone can teach me how?
COMMUNITY QUESTION
when you touch a brick the fogend changes to x number, how i can do that?
1 answer
If you want it to only change for the player that touches, you would put this in a localscript in somewhere like StarterGui if you have FilteringEnabled:
workspace["BrickNameHere"].Touched:Connect(function(hit)
if hit.Parent == game.Players.LocalPlayer.Character then
game.Lighting.FogEnd = 10 --change to new fogend
end
end)
Otherwise, if you want the fog to change for everyone, you can do something like this in a normal script inside the part:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
game.Lighting.FogEnd = 10 --change to new fogend
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Thanks so much!
Why didn't you accept his answer.