I’m making a battleground game and I’m struggle with changing the movement animation like walk,jump, and more animations. I’ve found plenty of solution. but none of them work. So, It makes me thinking that how can I fix the problem. And that’s where I came up the solution.
The code below located inside character’s Animate which is localscript, at the end of the script.
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
--signals when animationid changes (this is where i add)
for _,v in script:GetDescendants() do
if v:IsA("Animation") then
v:GetPropertyChangedSignal("AnimationId"):Connect(stopAllAnimations)
end
end
-- run
while Figure.Parent ~= nil do
local _, time = wait(0.1)
move(time)
end
I wanna ask if this works accurately and doesn’t break any other animation and stuff.
If one animation has a higher priority (Action4 > Action3 … > Action > Movement > Idle > Core) it will play those instead of the lower prio ones. If animations are the same priority, it uses the weights of the animations to blend them together.
It means the animate script has the function to play animations that you replied. So there’ll be no problem of stopping all animations and then replay animation, right?
The default animate script shouldn’t be playing any animations with a higher priority than movement. AnimationPriority
I don’t know what would happen if you stopped & replayed them. It would probably be glitchy.
If you want to make custom movement animations (this applies to the default roblox animations, like walk, jump, idle, climb, etc.), you can:
First, run the game.
In the explorer, click on workspace and find your character model.
Open it and find the localscript that is named Animate.
Copy the script instance (not copying the code, but the whole instance)
Stop the game.
Now, go into StarterCharacterScripts and paste the script. Make sure it is still called Animate or otherwise it won’t work.
If you open the script and scroll down a bit until you find something that looks like this:
you can change the id to your respective animation, make sure movement anims have AnimationPriority Movement, Idle to Idle.
Also make sure to change the ones inside here:
If you are going to add other animations (for example, a punching animation) you can do it in a separate script but make sure the Animation Priority is action