Why isn't my custom animation playing when humanoid has higher walkspeed than 15?
So.. I created a custom character, and that is working perfectly. BUT: I managed to add a custom walking animation, then I tried adding a custom running animation that should play whenver the humanoid has a higher walkspedd than 15. I updated the animation inside "run" in the player, and changed the "run" rbxasset inside the Animate script. However, when I with my running script run, it just plays the walking animation at a faster speed.
That is when I added this to the Animate script, on the onRunning section of it to be exact.
function onRunning(speed) if speed > 0.01 then local scale = 15.0 playAnimation("walk", 0.1, Humanoid) setAnimationSpeed(speed / scale) pose = "Running" elseif speed > 15 then -- I added this part, from here... local scale = 15.0 playAnimation("run",0.1,Humanoid) setAnimationSpeed(speed / scale) pose = "Running" -- Till here else if emoteNames[currentAnim] == nil then playAnimation("idle", 0.1, Humanoid) pose = "Standing" end end end
I know that I am probably doing something insanely wrong, but I can not seem to figure out what I am doing wrong.
I have searched on the Roblox Wiki without any luck at all.
How would I play my running animation while the humanoid speed is higher than 15?
By the way: I have set the default walking speed of the humanoid to lower than 15, and my running script changes it to 16.
Any help is greatly appreciated!
15 is higher than 0.01
Perhaps consider switching your conditions around so that they don't capture eachother.
function onRunning(speed) if speed > 15 then local scale = 15.0 playAnimation("run",0.1,Humanoid) setAnimationSpeed(speed / scale) pose = "Running" -- Till here elseif speed > 0.01 then local scale = 15.0 playAnimation("walk", 0.1, Humanoid) setAnimationSpeed(speed / scale) pose = "Running" else if emoteNames[currentAnim] == nil then playAnimation("idle", 0.1, Humanoid) pose = "Standing" end end end