I’ve appended a function to the bottom of the default animation script, so that when a player begins sprinting the walk animation changes to a running animation. However, after the player stops moving, the walking/running animation continues to play on the server, but functions correctly on the client. This only occurs after the player has sprinted once; if the player has never sprinted before, it works normally.
Here is the code I have appended to the bottom of the ‘Animate’ script:
script.Parent.SprintActivate.OnClientEvent:Connect(function(value)
if value == true then
animNames.walk[1].id = "http://www.roblox.com/asset/?id=18257837863"
script.walk.WalkAnim.AnimationId = "rbxassetid://18257837863"
if script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Running then
script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end
else
animNames.walk[1].id = "http://www.roblox.com/asset/?id=127301488311753"
script.walk.WalkAnim.AnimationId = "rbxassetid://127301488311753"
if script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Running then
script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end
end
end)
(This code is before the while loop at the very bottom, so no, that’s not the reason.)
Originally, I had it manually begin playing the running animation, but that returned the same result.
Any help is much appreciated.