Hi. Im attempting to create a running script in which once you've reached a certain speed the animation changes to the default "run" animation which is automatically inputted in your character. My problem is that as I was searching through the default animation script I saw that Roblox already used a speed based animation system but after trying a few things i came to my current script. After much testing I cannot for the life of me figure out why it's not working so any help would be appreciated. Im using R6 btw. If theres any way I can avoid doing in my UserInputScript for WalkSpeed.

Current script:


function onRunning(speed)
	if speed > 0.01 and speed < 20 then
		playAnimation("walk", 0.1, Humanoid)
		if speed > 20 then
			playAnimation("run", 0.1, Humanoid)
		end
		pose = "Running"
	else
		if emoteNames[currentAnim] == nil then
			playAnimation("idle", 0.1, Humanoid)
			pose = "Standing"
		end
	end
end

3 comments

0

Can you show the entire script? Maybe the error is hidden somewhere else

0

If I'm presuming that's the whole script, you need to create locals

0

Sorry. It is not the entire script- It is the default animation script which is put in your character at start. It is 350 lines so i cant exactly post it.