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

Animation script runs with no errors but does not play animation?

Asked by 5 years ago

It prints anim played, does not show any errors with the script and yet does not work.

touched = false

repeat wait()until plr.Character.LowerTorso.Anchored == true
repeat wait()until plr.Character.LowerTorso.Anchored == false
wait(5)



while true do
    wait(.5)
    if touched == false then
        for _, descendant in pairs(plr.Character:GetDescendants())do
            if descendant:IsA("Part") or descendant:IsA("MeshPart") then
                descendant.Touched:Connect(function(hit)
                    if touched == false then
                        touched = true
                        script.Parent.MidAirAnim.Disabled = true
                        script.Parent.MidAirMovement.Disabled = true
                        plr.Character.Animation:Destroy()
                        plr.Character.LowerTorso.BodyVelocity:Destroy()
                        local CrashLandAnim = Instance.new("Animation", plr.Character)
                        CrashLandAnim.AnimationId = "http://www.roblox.com/asset/?id=2296730026"
                        local humanoid = plr.Character:WaitForChild("Humanoid")
                        local playanim = humanoid:LoadAnimation(CrashLandAnim)
                        playanim:Play()
                        print("anim played")
                    end
                end)
            end
        end
    end
end 
0
do you have a plr variable? Zenith_Lord 93 — 5y
0
yes FirezoneGamez 155 — 5y
0
Instead of using Instance.new, try putting the animation as a child of the script and see if that works. ScrubSadmir 200 — 5y

Answer this question