Hello. I’ve seen a lot of topics on how to change the default animations such as idle, walking, etc. But I’ve faced a problem where I want to change character walking and running animations when a certain event triggers. This means that I don’t want to just change the id of the animation objects in the animate local script in starter player scripts, but I want to do that after the character is loaded and already uses starter walking and running animations. I tried changing the ids of the animate script inside the character, but for some reason it doesn’t work. I hope I explained the problem clearly. Any help is much appreciated!
Maybe if you’re using a script disable it then when you fire the event call something to enable it?
Disable what script? If you mean disable the animate script, it will not play any default animations
I’ve been trying to do this as well and found a slightly hacky way of doing this. For whatever reason the default animation script can’t be made to listen for any new events, but you can change the functions for events the script is already listening for.
At the very bottom of the script, it has a bunch of events it listens for. They are used to switch the current animation of a player’s character. By changing one of these, you can set whatever animation you want.
I recommend changing the function for humanoid.PlatformStanding since this isn’t usually used outside of some Roblox gears, and setting the humanoid’s PlatformStanding value to true when you want to switch animations. The only problem is once the value is set to true, the player’s character is put into freefall and you have to anchor them so their legs don’t go through the floor.
Here’s an example of what I’m talking about:
--line 516 of animate script
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(function()
script.walk.WalkAnim.AnimationId = "InsertAnimationIdHere"
animNames.walk[1].id = "InsertAnimationIdHere"
configureAnimationSet("walk", animNames.walk)
end)
Humanoid.Swimming:connect(onSwimming)