I've been experiencing with my own custom animated sprint script and i'm having problems with the Animation starting when i'm running but not when i'm standing still. here is my method:
local UIS = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local isSprinting = false UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift and isSprinting == false then isSprinting = true Player.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=5202688739" Player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=5202688739" Player.Character.Humanoid.WalkSpeed = 25 if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then local Track = Instance.new("Animation") Track.AnimationId = "rbxassetid://5202688739" local Anim = Player.Character.Humanoid:LoadAnimation(Track) Anim:Play() end end end) UIS.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift and isSprinting == true then isSprinting = false Player.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354" Player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354" Player.Character.Humanoid.WalkSpeed = 16 if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then local Track = Instance.new("Animation") Track.AnimationId = "rbxassetid://180426354" local Anim = Player.Character.Humanoid:LoadAnimation(Track) Anim:Play() end end end)
Make Sure your Animation is actually set to Action, The System goes like this, Core -> Idle -> Movement -> Action
, If your Using ****Animation Editor****, Click the Three Dots, Proceed to ****Animation Priority**** and Choose Action.