Part Touch then Script Happens

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)```

So the particles would only activate if they are like within the actual size of the part or whatever?

You can use TouchEnded event

to detect if the player leave the touchPart

How would that work exactly? Like how would the script look.