Sprinting animation works while not moving?
So basically Im trying to make a sprinting animation but if you're standing still and hold shift the animation plays even though you're not moving any help please?
01 | uis = game:GetService( "UserInputService" ) |
02 | plr = game.Players.LocalPlayer |
03 | character = game.Workspace:WaitForChild(plr.name) |
04 | Character = plr.Character |
07 | uis.InputBegan:connect( function (input) |
08 | if input.KeyCode = = Enum.KeyCode.LeftShift |
11 | character.Humanoid.WalkSpeed = 30 |
12 | local Anim = Instance.new( 'Animation' ) |
14 | PlayAnim = Character.Humanoid:LoadAnimation(Anim) |
18 | if character.Humanoid.WalkSpeed = = 0 then return else end |
21 | uis.InputEnded:connect( function (input) |
22 | if input.KeyCode = = Enum.KeyCode.LeftShift |
25 | character.Humanoid.WalkSpeed = 16 |