The Touched event is firing multiple times even when the character has not exited and re-entered the zone. This creates false triggers that should only happen once per entry.
Steps to Reproduce:
Kill a player inside the zone
Touch the player body parts after he died and try to move the fallen body parts
Observe that Touched events continues to trigger even though the player hasn’t moved out from the zone.
The Touched event keeps triggering repeatedly while the character is still inside the zone
Expected behavior
The Touched event should only fire once upon initial contact unless the touching part leaves and re-enters the zone because the player is still inside the zone and hasnt go out
Touch Script
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Zone = script.Parent
local Tool = ReplicatedStorage.Shared.Classes.CombatSystem.CombatTool
script.Parent.Touched:Connect(function(hit :BasePart)
if hit.Name ~= "HumanoidRootPart" then return end
local char = hit.Parent
local plr = game.Players:FindFirstChild(char.Name)
if not plr then return end
local hum = char:FindFirstChildOfClass("Humanoid")
if hum.Health == 0 then return end
local tool = char:FindFirstChildOfClass("Tool") or plr.Backpack:FindFirstChild(Tool.Name)
if tool then return end
print("Touching",char.Name)
local tool = Tool:Clone()
hum:EquipTool(tool)
end)
script.Parent.TouchEnded:Connect(function(hit :BasePart)
if hit.Name ~= "HumanoidRootPart" then return end
local char = hit.Parent
print("Untouched", char.Name)
local plr = game.Players:GetPlayerFromCharacter(char)
if not plr then return end
local tool = char:FindFirstChildOfClass("Tool") or plr.Backpack:FindFirstChild(Tool.Name)
if tool then tool:Destroy() end
end)