Creating a collision block which only deals damage to individual players once

I’m designing a sword script where attached has a collision block, a block where if an enemy player touches it it would give out specific damage. However with the generic linked sword script it triggers several damages against a player when they touch the sword.

How should I go about when I want the collision block to only hurt a player once for every player that touch the collision block for every swing.

So if there are several player caught on the collision block during a sword swing, it would deal a damage on each player once.

I’m a bit stumped how I should do this.

you can add a mapped debounce array

ie.
damagedPlayers = {} – debounce that refreshes to {} after each swing of the sword.

if damagedPlayers[player] == nil then
damagedPlayers[player] = true
– your code to damage player, etc…
end

1 Like

Do you know about Debounces ??