How to make an attack that hit multiple players but only hits each player once

When using .Touched, it repeats the damage so if anyone has a solution for this it would be great thanks!

function M1Dmg(toucher)
	if toucher.Parent:IsA(PlayersHitWithM1) then 
		return 
	else
		print("continue")
		
		table.insert(PlayersHitWithM1, toucher.Parent)
		toucher.Parent.Humanoid:TakeDamage(Configs["Damage"])
	end
	
	
end
1 Like
function M1Dmg(Hit)
	if (not PlayersHitWithM1[Hit.Parent.Name]) then 
		PlayersHitWithM1[#PlayersHitWithM1+1] = Hit.Parent.Name
		Hit.Parent.Humanoid:TakeDamage(Configs["Damage"])
	end
end
1 Like

that did solve one of the issues but now if i punch before i hit something the damage stacks

It’s only supposed to do 15 damage

Scratch off what i said before, the problem is still relevant. I added a print to detect when damage is dealt and It fired multiple times when hiting something.
image

You could use muchacho’s hitbox, it’s hitboxes are perfect for me.

I assume you are using .Touched for this, This isnt the best way, Although im not sure how to solve your problem. like @Bovious said, You should use Muchacho hitbox, It uses spatial queries, and its really good.

Muchacho hitbox: https://www.youtube.com/watch?v=kXXYEo3cXCY

I found a solution other than Muchacho’s Hitbox, thanks for all your assistance tho.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.