✓ Accepted answer
Alright so you're gonna have to insert a remote into ReplicatedStorage. Name the remote event "CreateFog".
Insert a Script into the part you want to be touched to create the fog and paste the following script into the Script
local Touched
Touched = script.Parent.Touched:Connect(function(hit)
if not hit.Parent:FindFirstChild("HumanoidRootPart") then return end
local target = hit.Parent
game.ReplicatedStorage.CreateFog:FireClient(game.Players:GetPlayerFromCharacter(target))
end)
After you're finished with the script, insert a LocalScript into StarterPlayerScripts and paste the following script into the LocalScript
game.ReplicatedStorage.CreateFog.OnClientEvent:Connect(function()
local Lighting = game:GetService("Lighting")
Lighting.FogColor = Color3.new(0, 0, 0)
Lighting.FogEnd = 100
end)
This was tested and it works.
5 comments
Also, there are indents in my coding, not sure why they didn't want to appear
Try copying this code in a LocalScript.
Assuming you're answering my question and not giving me a solution to fixing my script indents here, I tried replacing the script with a LocalScript, and it just didn't work. Sorry
it should work if you move it to a localscript, if it doesn't then the only thing I see is that you left the script.Parent in the localscript and the parent is no longer the touchpad
Just for clarity, I have to move the LocalScript to somewhere besides the part they have to touch, right?