I'm trying to make it where once the players are hit by a part it damages them, but also uses debounce so the damage only fires once for each player.
What I have so far:
local deb = false
Part.Touched:Connect(function(hit)
if not deb then
if hit.Parent:FindFirstChild("Humanoid") and game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) then
deb = true
local targetPlayer = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
local targetCharacter = targetPlayer.Character
local targetHumanoid = targetCharacter.Humanoid
targetHumanoid:TakeDamage(25)
end
deb = false
end
end)
Note: This isn't the real script just an example. The problem with this example script is that it would only hit the first player, damage that player, then hit the other, but it wouldn't hit them both at once.

3 comments
Ah, so you're using 1 part to damage multiple players, but you don't want it to hurt them more than once?
^ Yes, I've read somewhere that you're supposed to use a table whilelist to check if the player has been hit before, but I have no clue how that would work.
YO you are gonna need Remote Functions