Ad
Log in to vote
0

Animation won't play fully?

Asked by
sameb556 -12
15 days ago
Edited 15 days ago

I have a script and it plays an animation every time a tool is activated but it doesn't play fully and cuts the animation in half

I've tried to change the animation Priority but it doesn't seem to do anything

script in tool:

        local tool = script.Parent
        local waitTime = 1
        local animNumber = 1
        local canHit = script.Parent:WaitForChild("canHit").Value
        local canDmg = script.Parent:WaitForChild("CanDamage").Value

        canHit = true
        canDmg = false

        local attack1 = script.Parent.Attack1

        tool.Activated:Connect(function()
            if canHit == true then
                canHit = false

                local Humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
                local animator = Humanoid:FindFirstChildOfClass("Animator")
                local Anim1 = Humanoid:LoadAnimation(attack1)
                Anim1.Priority= Enum.AnimationPriority.Action

                if animNumber == 1 then
                    canDmg = true
                        Anim1:Play()
                        Anim1.Stopped:Wait(0.02)
                        canDmg = false
                    canHit = true
                end
            end
        end)

        script.Parent.Blade.Touched:Connect(function(hit)
            if hit.Parent:FindFirstChild("HumanoidRootPart") and script.Parent.CanDamage.Value == true then
                print(hit)
            end
        end)

Answer this question