local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=(my id is here)"
mouse.KeyDown:connect(function(key)
if key == "r" then
local playAnim = humanoid:LoadAnimation(anim)
playAnim:Play()
game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
game.StarterPlayer.EnableMouseLockOption = false
game.StarterPlayer.AutoJumpEnabled = false
game.
wait(3.2)
game:GetService("StarterGui"):SetCore("ResetButtonCallback", true)
game.StarterPlayer.EnableMouseLockOption = true
game.StarterPlayer.AutoJumpEnabled = true
end
end)
COMMUNITY QUESTION
How do I make an animation stop playing via press of "G"?
1 answer
local player = game.Players.LocalPlayer repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local anim = Instance.new("Animation") anim.AnimationId = "http://www.roblox.com/asset/?id=(my id is here)"
mouse.KeyDown:connect(function(key) if key == "r" then local playAnim = humanoid:LoadAnimation(anim) playAnim:Play() game:GetService("StarterGui"):SetCore("ResetButtonCallback", false) game.StarterPlayer.EnableMouseLockOption = false game.StarterPlayer.AutoJumpEnabled = false game. wait(3.2) game:GetService("StarterGui"):SetCore("ResetButtonCallback", true) game.StarterPlayer.EnableMouseLockOption = true game.StarterPlayer.AutoJumpEnabled = true end end)
3 comments
0
I dont know any answers, but this is the script
0
I don't think thats an answer.. you just copied my code, pasted it and said it was the answer... this doesn't solve anything
0
i already said i dont know any answer, i just posted it so people could understand
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I think you should use UserInputService instead of Player.Mouse. Because you want to check is key "r" and key "g" is pressing or not. And you should use GetPlayingAnimationTracks ( ) to get the AnimationTracks from Animation, because AnimationTracks has :Stop() function.
please follow https://scriptinghelpers.org/help/how-post-good-questions-answers