Custom Walk Animation Not Stopping

Hey DevForums, I’m working on a physics lab just to get better at scripting. I was working on a custom walking animation and all goes well. But the animation won’t stop playing even when I stop moving. One thing I’ve tried is checking the magnitude of the player HumanoidRootPart velocity (that way I made it so if the walk speed of the character is 0, it stops the anim. of course though, it doesn’t work).

Heres the code:

   Character.Humanoid.Running:Connect(function(speed)
     	if speed <= 20 and speed > 0 then
     		Character.Humanoid:LoadAnimation(script:WaitForChild("Walking")):Play(0.2)
     	elseif speed == 0 or Character.HumanoidRootPart.Velocity.Magnitude == 0 then
     		Character.Humanoid:LoadAnimation(script:WaitForChild("Walking")):Stop(0.2)
     	end
     end)

try to change the default walk animation to your costom walk animation

  1. run the game get the costom animate script from your character
  2. paste the script into startercharacterscripts
walk = 	{ 	
		{ id = "http://www.roblox.com/asset/?id=5866191656", weight = 10 } 
			}, 
	run = 	{
		{ id = "http://www.roblox.com/asset/?id=5866191656", weight = 10 } 
			}, 

change these to your ids

In my animation script or the default roblox anim script? If your saying the default, I would’ve done that, but the reason I went to the forums is because I wanted the animations to transition smoothly.

this post is similar to this post: Sitting animations not working in Team Create
Please do check it out! :smiley:

Your solution is simple! Create a reference to the loaded animation outside of the function. Your problem: in the code, you’re loading the animation each time. It only needs to be loaded once as shown:

local Animation = Character.Humanoid:LoadAnimation(script:WaitForChild("Walking"))
   Character.Humanoid.Running:Connect(function(speed)
     	if speed <= 20 and speed > 0 then
     		Animation:Play(0.2)
     	elseif speed == 0 or Character.HumanoidRootPart.Velocity.Magnitude == 0 then
     		Animation:Stop(0.2)
     	end
     end)
3 Likes

That’s not the problem. I see the animations fine.

No, thats not the problem… you see for ex: the group owns the game, and if you own the animation then it wont play… so if the group owns the game make sure the group owns the animations too!!

I never said anything about me not seeing the animations.

I dont think you understand my point… please try to understand it, if you cant or wont then i cannot help you…

Ohhhh, well that makes more sense. Thanks!

1 Like

The group does own the animation.

1 Like