Hey I am making a TagSystem and the debounce does not seem to work
The Issue: Whenever a player tags someone it keeps going back and forth
local debounce = false
local Character = script.parent
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local Player = game.Players:GetPlayerFromCharacter(Character)
print(Player.Name)
HumanoidRootPart.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and debounce == false and Hit.Name == "HumanoidRootPart" then
debounce = true
local CharacterTouched = Hit.Parent
local PlayerTouched = game.Players:GetPlayerFromCharacter(CharacterTouched)
local RemoteEvent = game.ReplicatedStorage.Tagged
RemoteEvent:FireServer(PlayerTouched,debounce)
wait(1.5)
debounce = false
else
if Hit.Parent:FindFirstChild("Humanoid") and debounce == true then
wait(1.5)
debounce = false
end
end
end)