How do I make an animation stop playing via press of "G"?
Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
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)