Run Animation Wont Play

Hello,

Im currently working on sprinting and to make a sprinting animation I just changed default animation script’s run animation but this doesn’t seem to work because when I sprint it just plays the walk animation but faster like normally it would do.

And I’m sure that

• The animation’s priority is correct
• The run animations weight is higher than walk
• The run animations Id is changed from the animate script and the instance
• The animation is owned by me

So I’m not sure why this doesn’t work

2 Likes

Hi there, TheSenorDuck. The RunAnim that the default Animate script made by Roblox isn’t an actual animation for sprinting the way you probably intend for it to be. I don’t know why they named it that as it is confusing - you’re right, it definitely looks like it just plays the animation faster.

To implement a sprint system in the past while merging with the existing default Animate script, I’ve made some edits in various parts that look something like this (you can use the search feature to find where these parts are inside the Animate script):

------------------------------------- 

local animNames = { 
	idle = 	{	
		{ id = "http://www.roblox.com/asset/?id=507766666", weight = 1 },
		{ id = "http://www.roblox.com/asset/?id=507766951", weight = 1 },
		{ id = "http://www.roblox.com/asset/?id=507766388", weight = 9 }
	},
	walk = 	{ 	
		{ id = "http://www.roblox.com/asset/?id=507777826", weight = 10 } 
	}, 
	run = 	{
		{ id = "http://www.roblox.com/asset/?id=507767714", weight = 10 } 
	}, 
	runOnKeybind = 	{
		{ id = "http://www.roblox.com/asset/?id=507767714", weight = 10 } 
	}, 
------------------------------------- 

function onRunning(speed)	
	if speed > 0.75 and Humanoid.WalkSpeed <= 16 then
		local scale = Humanoid.WalkSpeed -- 16.0
		playAnimation("walk", 0.2, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Running"
	elseif speed > 0.75 and Humanoid.WalkSpeed > 16 then
		local scale = Humanoid.WalkSpeed -- 16.0
		playAnimation("runOnKeybind", 0.5, Humanoid)
		setAnimationSpeed(speed / scale)
		pose = "Running"
	else
		if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
			playAnimation("idle", 0.2, Humanoid)
			pose = "Standing"
		end
	end
end
------------------------------------- 

function stepAnimate(currentTime)
	local amplitude = 1
	local frequency = 1
	local deltaTime = currentTime - lastTick
	lastTick = currentTime

	local climbFudge = 0
	local setAngles = false

	if (jumpAnimTime > 0) then
		jumpAnimTime = jumpAnimTime - deltaTime
	end

	if (pose == "FreeFall" and jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif (pose == "Seated") then
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif (pose == "Running") then
		if Humanoid.WalkSpeed <= 16 then
			playAnimation("walk", 0.2, Humanoid)
		else
			playAnimation("runOnKeybind", 0.5, Humanoid)
		end

There may be better ways to do this of course, but if you’d like to do it my way and need some assistance just let me know!

1 Like

Thanks I will try that!

and someone told me that if the humanoids walk speed is high enough it would play the run animation instead of the walk animation so thats why I tried doung it like that.

I have a problem when I search stepAnimate no results show up maybe you may have written something wrong

I made the other changes

Perhaps you can send your entire Animate script on here or through a pastebin link?

I use the roblox default animate, the one that appears in the players characters but if you want I can send it later today

I’m aware it’s the default Animate script. I’m currently using that same script along with the changes I suggested, and it works fine. There must be an error in your modified version. If you still need help, send it along.

Did you make your animation with R6 or R15?

Make sure to change the Avatar type to what type you made your animation with. So if you made an R6 Animation, make sure to change the Avatar type to R6.

1 Like

I just copied it from my character on play mode and when I search there is no function called step animate

image

Okay I will try again if I cant still find the function maybe you can send the animate script but I will try again