Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --For having this work, you need to put a LocalPlayer in StarterGui. In that LocalScript, put an animation named "Animation" with
- --the right ID.
- --this is the script you'll need:
- repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
- myPlr = game.Players.LocalPlayer
- myChar = myPlr.Character
- myHum = myChar:findFirstChild("Humanoid")
- myMouse = myPlr:GetMouse()
- Animation = script:findFirstChild("Animation")
- Animations = {}
- animated = false
- myMouse.KeyDown:cnnect(function(key)
- key = key:lower()
- if key == "k" then -- You can change this to any letter.
- if animated == true then return end
- animated = true
- local animation = myHum:LoadAnimation(Animation)
- table.insert(Animations,animation)
- animation:Play()
- wait(2) --[[ This need to be equal to this formula: Animation length + 0.2 (for example: Animation length = 1 so wait(1.2)]]
- for _,v in pairs(Animations) do
- v:Stop()
- end
- Animations = {}
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement