I’m trying to make it so if a player touches a part then a script would happen, though if they are not near the part anymore then the script won’t happen. But it won’t work, the script is below.
TouchPart.Touched:Connect(function(TouchedHexPart)
local plr = game.Players:GetPlayerFromCharacter(TouchedHexPart.Parent)
if plr then
script.Parent.ParticleEmitter.Enabled = true
end
end)
TouchPart.Touched:Connect(function(TouchedHexPart)
local plr = game.Players:GetPlayerFromCharacter(TouchedHexPart.Parent)
if plr then
local particleEmitter = game.Workspace:FindFirstChild("ParticleEmitterName") -- Replace with the actual name of the ParticleEmitter
if particleEmitter then
particleEmitter.Enabled = true
end
end
end)```