Advertisement
ScripterLOl3424

animation

Dec 21st, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --For having this work, you need to put a LocalPlayer in StarterGui. In that LocalScript, put an animation named "Animation" with
  2. --the right ID.
  3.  
  4. --this is the script you'll need:
  5.  
  6. repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
  7. myPlr = game.Players.LocalPlayer
  8. myChar = myPlr.Character
  9. myHum = myChar:findFirstChild("Humanoid")
  10. myMouse = myPlr:GetMouse()
  11. Animation = script:findFirstChild("Animation")
  12. Animations = {}
  13.  
  14. animated = false
  15.  
  16. myMouse.KeyDown:cnnect(function(key)
  17. key = key:lower()
  18. if key == "k" then -- You can change this to any letter.
  19. if animated == true then return end
  20. animated = true
  21. local animation = myHum:LoadAnimation(Animation)
  22. table.insert(Animations,animation)
  23. animation:Play()
  24. wait(2) --[[ This need to be equal to this formula: Animation length + 0.2 (for example: Animation length = 1 so wait(1.2)]]
  25. for _,v in pairs(Animations) do
  26. v:Stop()
  27. end
  28. Animations = {}
  29. end
  30. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement