Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Would i be able to Play an Animation?

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

✓ Accepted answer
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.

1 comment

0

Thx Bro

This discussion is preserved as it was. New answers, comments, and votes are closed.