The Running animation changes when the player dashes forward while holding W, however it is supposed to change back when the user stops holding W or other stuff happens (attacking, stunned, etc…), but the animation wont change until the player stops moving.
function Run()
Front = 1
dec = 0
Animations["DashFront"]:Play()
chr.Animate.walk.WalkAnim.AnimationId = "rbxassetid://15992728336"
chr.Animate.run.RunAnim.AnimationId = "rbxassetid://15992728336"
local DashVelocity = Instance.new("BodyVelocity")
DashVelocity.MaxForce = Vector3.new(math.huge,0,math.huge)
DashVelocity.P = 9e9
DashVelocity.Parent = humrp
delay(config.FrontTime, function()
dec = 1
end)
repeat wait()
DashVelocity.Velocity = humrp.CFrame.LookVector * (Front * config.FrontSpeed) + humrp.CFrame.RightVector * (0 * config.FrontSpeed)
until dec == 1
DashVelocity:Destroy()
Values.Status.Dashing.Value = false
delay(config.SideCD, function()
Sidedb = false
end)
running = true
print("running = true")
hum.WalkSpeed = Values.WalkSpeed.Value * 1.25
repeat wait()
if UIS:IsKeyDown(Enum.KeyCode.W) and
statements.stunned.Value ~= true and
statements.ragdolled.Value ~= true and
statements.blocking.Value ~= true and
statements.attacking.Value ~= true
then
else
running = false
end
until running == false
print("running = false")
chr.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354"
chr.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354"
hum.WalkSpeed = Values.WalkSpeed.Value
end
This might have to do with the Animate script still using the old animation while you are still moving. (I’m just speculating here, as I don’t use the default Roblox Animate Script for handling custom animations.)
Have you tried using an loaded AnimationTrack for the Walking/Running Animation?
The Animator is a replacement for Humanoid, as loading animations in Humanoid is deprecated now, so I recommend using this instead.
Having to repeatedly change the AnimationId everytime a player stops or begins running is incredibly inefficient, I have tried this before but ended up failing terribly/ended up with lots of bugs.
Deprecated code is an outdated code that will probably break or get removed in the future, so it’s best to use an alternative
You can still use humanoid for animations, but I would personally prefer using animator as it is not deprecated.
Offtopic, why are you creating an instance inside of a loop?