Im trying to make a part and when you touch it it changes your fog.
I have done,
function onTouch(hit)
game.Lighting.FogEnd = 100
end
script.Parent.Touched:Connect(onTouch)
Im trying to make a part and when you touch it it changes your fog.
I have done,
function onTouch(hit)
game.Lighting.FogEnd = 100
end
script.Parent.Touched:Connect(onTouch)
You could use a RemoteEvent
for this.
Just change the script to a LocalScript, change the script.Parent
to where you want your touched Part to be, and put it inside StarterCharacter/StarterPlayer Scripts
Wait, what exactly are you trying to do then? Are you attempting to change the fog for just 1 player alone (Client wise)? Or is it for the entire server to see?
for just 1 player when they touch the brick
local thePart = workspace.somePart
function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent == game.Players.LocalPlayer.Character then
game.Lighting.FogEnd = 100
end
end
somePart.Touched:Connect(onTouch)
Give this a try if you don’t mind. Make sure to change the thePart
variable to your part.
thanks for the script! and its working now!