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

Is there any way to make an animation play in a global script?

Asked by 6 years ago

I was trying to make a spell script (newish to scripting) and I have the chatted event perfect, I just need the script to be global for the chatted event.

Here's what I have:

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg)
        if msg == "Fus Ro Dah" or "fus ro dah" or "frd" or "FUS RO DAH" then
            print("spell used: fus ro dah")
            local animation = Instance.new("Animation")
            animation.AnimationId = "http://www.roblox.com/Asset?ID=1788538969" -- your id here
            local animTrack = player.Character.Humanoid:LoadAnimation(animation) -- chanhe Humanoid to the target's Humanoid
            animTrack:Play()
        end
    end)
end)

It prints my output, no errors or anything for the animation part though.

0
It looks good to me. It may have something to do with the animation's priority (core, idle, movement, etc.) or the animation may be for a different rig type. Did you make the animation yourself? stratus797 0 — 6y
0
yeah I did I made it for R15 ExtremeNyanCat123 32 — 6y

Answer this question