Advertisement
Guest User

Run animation

a guest
May 14th, 2022
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local userinput = game:GetService("UserInputService")
  3. local keydown = false
  4.  
  5. local runanimation = Instance.new("Animation")
  6. runanimation.AnimationId = "rbxassetid://youranimationidhere"
  7. runanimation = player.Character.Humanoid:LoadAnimation(runanimation)
  8.  
  9.  
  10. userinput.InputBegan:Connect(function(input)
  11. if input.KeyCode == Enum.KeyCode.LeftShift then
  12. keydown = true
  13. end
  14. end)
  15.  
  16. userinput.InputEnded:Connect(function(input)
  17. if input.KeyCode == Enum.KeyCode.LeftShift then
  18. keydown = true
  19. end
  20. end)
  21.  
  22. while true do
  23. wait(0.1)
  24. if keydown == true then
  25. runanimation:Play()
  26. else
  27. runanimation:Stop()
  28. end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement