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

How would I play an animation?

Asked by
ultrabug 306 Moderation Voter
10 years ago

I made several animations for my project, but when I attempt to run them they do not play, how could I fix this? Here is my code in a Local Script, and animation I am running has the Id in it for my animation.

local animation=game.Workspace.Anim1
np=game.Players.LocalPlayer
np.Chatted:connect(function(msg)
    if msg==string.lower("atk") then
        local atk=np.Character.Humanoid:LoadAnimation(animation)
        atk:Play()
    end
end)

1 answer

Log in to vote
2
Answered by
DevWork 80
10 years ago

Well, after reviewing this script several times, I only found an error in line 4.

local animation=game.Workspace.Anim1
np=game.Players.LocalPlayer
np.Chatted:connect(function(msg)
    if msg:lower() == "atk" then
        local atk = np.Character.Humanoid:LoadAnimation(animation)
        atk:Play()
    end
end)
Ad

Answer this question