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

How Would i be able to Play an Animation?

Asked by 8 years ago
game:GetService("UserInputService").InputBegan:connect(function(Key)
   if Key.KeyCode == Enum.KeyCode.H then
     local char = game.Players.LocalPlayer.Character
     local humanoid = char.Humanoid
     local id = "http://www.roblox.com/asset?id=294995580"
     local ani = Instance.new("Animation")
    ani.AnimationId = id
    humanoid:LoadAnimation(ani)
   end
end)


1 answer

Log in to vote
0
Answered by 8 years ago
game:GetService("UserInputService").InputBegan:connect(function(Key)
   if Key.KeyCode == Enum.KeyCode.H then
     local char = game.Players.LocalPlayer.Character
     local humanoid = char.Humanoid
     local id = "http://www.roblox.com/asset?id=294995580"
     local ani = Instance.new("Animation")
    ani.AnimationId = id
    local loadAnimation = humanoid:LoadAnimation(ani)
    loadAnimation:Play()
   end
end)

Try this.

0
Thx Bro xlaser23 60 — 8y
Ad

Answer this question