Im trying to make a part that kill the other players when touched but not the player that used it. Here is the script but its not working.
card.Touched:Connect(function(hit) if not debounce then if hit and hit.Parent then print(hit.Parent.Name) if not hit.Parent.Name == player.Character.Name then local hum = hit.Parent:FindFirstChild('Humanoid') if hum then hum:TakeDamage(2) debounce = true end end end end end)
You never reset debounce. Typically the code is:
debounce = true --action here wait(0.1) -- or whatever cooldown you like debounce = false
A superior version of line 5 is if not player == game.Players:GetPlayerFromCharacter(hit.Parent) then
, as then it won't matter what things are named.