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

How to make an animation not play until another animation has been played?

Asked by 4 years ago

Slash sometimes play even lunge haven't been played yet.

script.Parent.Equipped:Connect(function(mouse)

    mouse.Button1Down:Connect(function()
            debounce = true
            lunge:Play()
    end)


    mouse.Button1Up:Connect(function()
            CanDamage.Value = true
            lunge:Stop()
            slash:Play()
            wait(1)
            slash:Stop()
    end)
end)
0
lunge.Stopped:Wait() Ziffixture 6913 — 4y
0
where should I put it? Inciney 7 — 4y
0
Is the lunge animation looped or not? skyaz1 72 — 4y

1 answer

Log in to vote
0
Answered by
skyaz1 72
4 years ago

This script just adds a debounce to make sure the player has lunged before the player can slash.
Unfortunately, you didn't provide as much information as needed, so I don't know exactly what the problem is, but this may help answer it.

    local hasLunged = false -- new debounce
    script.Parent.Equipped:Connect(function(mouse)

        mouse.Button1Down:Connect(function()
          lunge:Play()
             wait() -- how long u want it to last
            lunge:Stop()
        hasLunged = true -- the player has used lunge

        end)


        mouse.Button1Up:Connect(function()
             if hasLunged = true then -- only plays if the player has lunged
            CanDamage.Value = true
                slash:Play()
                wait(1)
                slash:Stop()
                Haslunged = false
            end
        end)
    end)

0
Ofc you don't need the wait() if lunge is not looped skyaz1 72 — 4y
0
if it works than u should accept the answer so people know it answered. skyaz1 72 — 4y
0
wow. i actually just gave on this project since i really dont know to fix this. thank you anyways Inciney 7 — 4y
0
lol skyaz1 72 — 4y
Ad

Answer this question