1x1x1x1IAMbck

How To Animate Walk And Run

May 23rd, 2018
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. local UIS = game:GetService('UserInputService')
  2. local Player = game.Players.LocalPlayer
  3. local Character = Player.Character
  4.  
  5. UIS.InputBegan:connect(function(input)--When a player has pressed LeftShift it will play the animation and it will set the normal walking speed (16) to 35.
  6. if input.KeyCode == Enum.KeyCode.LeftShift then
  7. Character.Humanoid.WalkSpeed = 35
  8. local Anim = Instance.new('Animation')
  9. Anim.AnimationId = 'rbxassetid://1086127405'
  10. PlayAnim = Character.Humanoid:LoadAnimation(Anim)
  11. PlayAnim:Play()
  12. end
  13. end)
  14.  
  15. UIS.InputEnded:connect(function(input)
  16. if input.KeyCode == Enum.KeyCode.LeftShift then
  17. Character.Humanoid.WalkSpeed = 16
  18. PlayAnim:Stop()
  19. end
  20. end)
Add Comment
Please, Sign In to add comment