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)

3 comments
Did you set your animation to action in animation editor? If its at core then set it to action
ye try setting it to action
I wasn't having problems activating the animation I was having problems stopping the animation from activating if the Player wasn't already walking. Sorry if the Title mislead you