I want to make it so that if you touch a part fog appears on your client but nobody elses, the issue is that when i try to fix it, it hasn’t worked yet. I tried to look for solutions but there was only 2 i was able to see and they didnt work for me
How did you tried that ?
Make a part, put a script inside the part, create a RemoteEvent, create a localscript in StarterCharacterScripts
In the part’s script, make that when the part touched it fire the RemoteEvent
In the localScript, make that when the RemoteEvent is fire then apply the fog.
It should work.
i put this inside my part
local part = script.Parent
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game.ReplicatedStorage.FogEvent:FireClient()
end
end)
and this inside startercharacter scripts
local function Fired(player)
game.Lighting.FogEnd = 100
end
game.ReplicatedStorage.FogEvent.OnClientEvent:Connect(Fired)
it doesnt work
can u tell me why
The script inside the part should be this :
local part = script.Parent
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game.ReplicatedStorage.FogEvent:FireClient(player)
end
end)
Thanks for helping me fix this
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.