Need help with the hitbox

I can’t figure out how I could make the hitbox deal damage to several players but not multiply the damage, if I remove ‘Disconnect’ then it will cause damage to all those who are inside the hitbox while multiplying the damage or something else (in short, the hitbox touches more than 1 time)

	local connection
	connection = hitbox.Touched:Connect(function(hit)
		local hit_player = game.Players:GetPlayerFromCharacter(hit.Parent)
		local hit_humanoid = hit.Parent:FindFirstChild('Humanoid')
		
		if not (hit_player and hit_player == localplayer) and hit_humanoid and punchType == 'NormalPunch' then
			
			punchFunc(hit_humanoid, HumRP)
			connection:Disconnect()
			
		elseif not (hit_player and hit_player == localplayer) and hit_humanoid and punchType == 'LastPunch' then
			
			punchFunc(hit_humanoid, HumRP)
			connection:Disconnect()
		end
		
	end)
  1. Create a table for humanoids when you attack.
  2. Check if humanoid is in table (If not proceed).
  3. Damage humanoid & put humanoid in table.
  4. Cannot damage the humanoid multiple times (woohoo!!)
1 Like

Thanks my friend!

I’ve been racking my head for so long and it turns out so easy

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