Hello, In my game I have a script that replaces all the default animations and plays my custom ones.
game.Players.PlayerAdded:connect(function(player) while not player.Character do wait() end local character = player.Character local animateScript = character.Animate animateScript.idle.Animation2.AnimationId = 'http://www.roblox.com/asset/?id=633000480' animateScript.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=633000480' animateScript.fall.FallAnim.AnimationId = 'http://www.roblox.com/asset/?id=632774213' animateScript.jump.JumpAnim.AnimationId = 'http://www.roblox.com/asset/?id=632751324' animateScript.walk.WalkAnim.AnimationId = 'http://www.roblox.com/asset/?id=631862913' end)
How do I make it so that when a press a certain key that all of these animations will stop and play another animation?
So if i press "z" all of these animations will stop playing and another animation will play (and also set the player's speed to zero) Then after the animation is dont playing once reactivate all of the other animations and deactivate this one?
Thanks -UnbeatableChicken
To stop an animation, read this wiki post. Read up on UserInputService to manage key presses.
Here's how to approach it:
When the Z key is pressed, Stop any current animation, set the WalkSpeed to 0, Play the animation wait for the event Stopped to be fired, then replace all of the values.