How would I switch between Idle Animations smoothly

Hello! Recently I’ve been attempting to make a tool based fighting game, and have encountered an error! Basically, when a player equips a tool (for an example, let’s say a sword), the script will attempt to change the core animations to the new ones, such as a sword idle, running, jump etc. Now the problem is, replacing the Animate script with a different one doesn’t work, becauseif the player is running while switching the new core script will not recognize the running animation track as it’s own and the idle will play overtop, replacing animation ids, also does not work, because you must jump/change states for it to refresh. So I came to the conclusion that I needed to edit the core animations script. Has anyone ever done this before? If so could you please provide how you did it? I would really really appreciate it!
Have a good day!

Note: Sorry if this is the wrong category, was wondering between art design and scripting support. Also sorry about any grammatical mistakes! I am currently writing on a phone, and therefore can’t add images or gifs either!
EDIT: OH GOD POSTED IT UNDER ART DESIGN

Alright, just so you can understand this from what I’m getting at:
-You want to change the core roblox animations to new ones
-Roblox’s core animations play over the top or a frame before your animations play because of the refresh
-You want to know if changing the core animate script will fix this

Your answer is yes, it will. Changing the core animation script will stop any of Roblox’s default animations from playing over the top without any stress (as at that point they aren’t loaded/loading). For obvious reasons, if you want to have multiple different idles/sword animations ext. then you’ll need to add in your own functions and variables to the core animate script which changes the assetid of said animation based on your weapon’s animations. Hope this helps :+1:

(There might be a better way of doing this but this is the way I know)

Thank you! I’ll read into this and try to get it to work!

I suggest making your own custom script for animating (assuming you will have multiple items your changing the players animation with)

Have a StringValue (value is the the name of which animation, when its just default youd have the value something like “None”)

When you’re equipping a sword, change the value to the name of the animation (ex. “Sword1”), and the animation script detects that, changes the players humanoid current state to idle (for if theyre running), and loads the new animations based on the value of the StringValue (Maybe within a table)

Then, change the animation you’re using based on the player state (running, idle, freefalling, landed, etc)

When they are unequipping, do the same but change the string value back to “None”

(This might not be the best solution, I haven’t tested it)


OR if you only want to change the idle animation, just load the animation
Make sure its priority is Idle

If you don’t animate legs, Roblox’s core animation should automatically move the legs.
I suggest also animating the head because some core animations can make your head bobble a lot which looks odd.

local idleAnim

tool.Equipped:Connect(function()
idleAnim = Humanoid:LoadAnimation([[--your animation--]])
idleAnim:Play()
end)

when unequipping, same thing but with stop

tool.Unequipped:Connect(function()
if idleAnim then 
idleAnim:Stop() 
end
end)

MAKE SURE YOUR ANIMATION HAS LOOP ON!

When you’re clicking (slash sword), just load your swing animation once, without loop toggled on
Make sure its priority is Action

Thank you! Changing a string value under the animate script sounds promising! I’ll definitely try it out!