How to animate multiple characters at once?

Hey,

I wanted to know if there would be any way to animate two characters at once, for example, one being an NPC, and the other one being the player? Basically, you walk up to an NPC, and for example, they suddenly hug or shake hands with your character, is that possible?

Thanks.

2 Likes

Absolutely. It pretty much comes down to how you wish to trigger the interaction (ClickDetector, GUI, etc.) and then playing the animation(s) on any target humanoids, such as the player and/or NPCs.

Using Animations in Games

what about trigger by ClickDetector?

also, I meant how to animate TWO characters at once, not separate animations?

Use the MouseClick event of a ClickDetector to run any code you’ve written once it’s been clicked on.

And you should be able to play the same animation on multiple characters simultaneously, provided their joints are identical. Simply load the animation on each character with Humanoid:LoadAnimation followed by calling AnimationTrack:Play.

Okay and how do we animate two characters in the same animation track?

I saw a post about something about this before, you should be able to find something if you keep searching. I think it had to do something with Moon Animator which you could animate 2 players at once/on the same track.

Fairly certain if you use 2 different animations, and tweak the very carefully, you can make this work.

Try a coroutine that plays both the animations at the same time in the script, but one for the NPC and one for the player. OR try using string/bool values in the character, and once it “detects” a player close enough it’ll enable the bool in the character causing the animation to play on the character, and at the same time toggling it on the NPC as well.

It’ll probably be very time consuming and take a lot of tweaking to get it just right, but might work. Probably not the best method out there but its worth a shot.

https://www.youtube.com/watch?v=JlWkTGpyJDY&ab_channel=SwiftyRBLX

2 Likes

Yeah, of course. If your NPCs have humanoids, you can use Humanoid:LoadAnimation(). Either that or you can procedurally animate with trigonometry :sweat_smile:

1 Like

If you are using this plugin called Moon.Animator, I’d group them together and animate one at a time.

1 Like

yes, this. what he said

30char

1 Like

Okay so what I did is I made the animations in moon editor and exported them, then on each NPC, I loaded the animations in and made a script to play them simultaneously on each one. Works for me!

(What you can do with it: https://gyazo.com/f6e854a0d1281b537178bf0a4bdab2db)

Should I make a youtube video/community tutorial on it?

3 Likes

video is gone
can you repost?
thanks

3 Likes

this video is private, unable to watch it