Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I change the walk animation after it is playing?

I am trying to make a run script with animations that play only when you're running. It seems that ROBLOX has made some changes to animations though, and this is noted by the wiki: http://wiki.roblox.com/index.php?title=Changing_default_character_animations

When I change the walk animation, it actually has to stop playing before my new one loads. This is a problem because I need the change to be instant, and the fix the wiki doesn't work. It stops all the animations, but mine do not play until I stop walking.

Here is what I am doing:

--When the player starts running:
for _,v in pairs(Humanoid:GetPlayingAnimationTracks()) do v:Stop(0) end
walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=252557606"

1 answer

Well, one possible solution; I can guess you've already binded a key for it...

So, here's my suggestion, in shorter terms.

--Find players

--I honestly can't interpret this wiki page, go here: http://wiki.roblox.com/index.php?title=API:Class/Player/Character

--I also don't know if your script is local or server.

--Get player speed, and then play animation if meets standard.

--local speed = [yourValue]

if character.Humanoid.WalkSpeed >= speed then --The reason I am placing the speed value in comments is plainly because you can eliminate using a local value and replace the ">= speed" with the value.

--Play animation, I cannot easily code this either, sorry.

--I have worked on learning functions of scripting, and I know how a lot of stuff works, just not how to code it yet. Hope I helped! ~iiPostMaster

This discussion is preserved as it was. New answers, comments, and votes are closed.