Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do i make my punch animation cancollide for a while?

Asked by 4 years ago

I want to make my left arm cancollide because if arm just gets it into the wall there will have chance to get bugs.

LArm = script.Parent.Parent:WaitForChild("Left Arm")
RArm = script.Parent.Parent:WaitForChild("Left Arm")  

attacking = false 
canattack = false 

script.Parent.RemoteEvent.OnServerEvent:connect(function(plr, AttackArm)
    canattack = true 
    attacking = AttackArm and "Left" or "left" 
    wait(0.6)
    attacking = false 
end)

function a(hit, arm)
    if canattack  and attacking == arm and hit.Parent:FindFirstChild("Humanoid") ~= nil then 
        canattack = false 
        script.pp:Play() 
        hit.Parent.Humanoid:TakeDamage(10) 
    end 
end

LArm.Touched:connect(function(hit)
    a(hit, "left")
end)
RArm.Touched:connect(function(hit)
    a(hit, "Left")
end)

Answer this question