I feel like i could make it more efficient / accurate and not just this basic lump of code
Hitbox.Touched:Connect(function(hit)
local Character = hit.Parent
local Humanoid = Character:WaitForChild("Humanoid")
if Humanoid and Character.Name ~= plr.Name then
if not HasTakenDamage then
HasTakenDamage = true
local sound = script.hit_punch_l:Clone()
sound.Parent = Humanoid
task.wait(0.1)
sound:Play()
game.Debris:AddItem(sound, 2)
local bh = game.ReplicatedStorage["Basic hit"].Attachment:Clone()
bh.Parent = Character:FindFirstChild("HumanoidRootPart")
for _, v in pairs(bh:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(bh, 0.2)
Humanoid:TakeDamage(5)
local Knockback = Character.Humanoid
task.wait(5)
HasTakenDamage = false
end
end
end)
end)