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.
01 | local player = game.Players.LocalPlayer |
02 | repeat wait() until player.Character.Humanoid |
03 | local humanoid = player.Character.Humanoid |
04 | local mouse = player:GetMouse() |
06 | local anim = Instance.new( "Animation" ) |
09 | mouse.KeyDown:connect( function (key) |
11 | local playAnim = humanoid:LoadAnimation(anim) |
13 | game:GetService( "StarterGui" ):SetCore( "ResetButtonCallback" , false ) |
14 | game.StarterPlayer.EnableMouseLockOption = false |
15 | game.StarterPlayer.AutoJumpEnabled = false |
18 | game:GetService( "StarterGui" ):SetCore( "ResetButtonCallback" , true ) |
19 | game.StarterPlayer.EnableMouseLockOption = true |
20 | game.StarterPlayer.AutoJumpEnabled = true |