Need a base on how to SCRIPT 2+ player animated moves

Hey devs! I waited to post this until the smart people get on, so if you find yourself on this post great job :happy4: !!!

So as the title suggets… I need help scripting animations into my game.

BUT before you tell me to just use loadAnimation on both humanoids with both victim and attacker at the same time I ALREADY KNOW THAT!!! :angry:

HOWEVER

In my game Death By Rarity, I start my moves by disabling both players’ movement, giving them iframes and changing the victim’s HumanoidRootPart (HRP) Cframe to the attacker player’s HRP Cframe.

This doesn’t work, as sometimes the victim is offset slightly.

I personally think the solution to those moves in particular would be to add some sort of constraint in order to keep the victim in a specific place.

HOWEVER!! (x2)

I want to make actual cutscene moves (with custom camera movements) and have them play. Here are my main questions:

(:exclamation:) 1. Is there a way I can script camera movements done in Moon Animator 2? (:exclamation:)

  1. How can I position both players to be reliably at the same spot so I can play both animations with them starting at the same position?

  2. How could I chain 2 animations (startup > action) smoothly? An example would be a character taking a stance before running. I can make the animations but it’s rocket science trying to figure out the right time to place an animation event to play the animation.

To anybody willing to help, you don’t need to answer all the questions. Any help is appreciated. If there are posts similar to this, I apologize but I haven’t found them so please link them.

Hello. You didn’t wait long enough for the smart people to get on so all you have is me.

To answer your questions.

  1. I don’t have experience with camera movements but I may have a possible solution.
    You can create a part and add an animationcontroller, animate the part in moon animator, and then with a script make a characters camera CFrame equal to the part you animated.
    Camera.wmv (419.1 KB)

  2. The reason there is an offset may be because your characters collide with eachother and push eachother away. You could disable collisions with players or you could anchor the humanoidrootparts.

  3. To chain animations you could play another one as soon as one ends. You rename a keyframe and then detect the changed name to signal the running animation to play. For this you would use “KeyframeReached”.

Hope this helps!

haha don’t worry everybody to replies to me is smart since i’ll be a billionare one day and give everyone who helped me 1 snowbuck.

ANYWAYS i forgot to mention some things

for 1. that’s a great solution! However some people (creators of Heroes Battlegrounds) use the actual moon animator camera save and import it into the game as an animation, it’s way beyond me. If I can’t figure out how to do that, I’ll probably go with your solution.

  1. I anchor the humanoid root parts so collision isn’t the issue. On the server, the animation plays perfectly but due to ping-related issues both clients experience different distorted versions of the animations. Like I said, I play my animations on the server so I don’t understand what a solution could be.

  2. When I do that, they go to a resting pose before going to the next animation. I need to time the next animation but not when the animation completely ends. I think this just factors down to manual trial and error.

Thank you for your help though, if my clarification gave you more ideas throw em at me, I appreciate each of them.

for 2. with the distorted local animations I may have a solution.

In games such as Anomalous Activities basically everything is local sided(99% sure).

If I’m correct, there is lag when you do things from the server, but if you do it from the client this lag is removed. If you do what Anomalous Activities does you can make the animations play locally for every single player instead of doing it once on the server.

You could probably use remote events to send a signal to every client to play an animation locally.

for 3. you could name a keyframe “STOP” or something else before the actual animation ends so it moves on to the next. To prevent the startup from being cut off you could copy and paste the last keyframe and move it further down the timeline.

This will result in a freeze at the end of the animation. Name the last keyframe before the copied one “STOP”(as I said above) and at that point the running animation will start leaving no room for the resting pose.

  1. Animations need to be server-sided so the animation events won’t be abused by exploiters

  2. Makes sense, this is what i’ll do!!!

Thanks again for your input broski.

Can you provide an example of how the animations in your game would be abused by exploiters? Typically animations only serve as visual effects which the server doesn’t need to see. The only way you can synchronize animations between multiple players is by having each client play their own version of the animations.

This should not introduce any vulnerabilities in your code since it does not give any additional authority to the client. The server is still the one who tells the clients that they should play an animation; the difference is that instead of only playing the local player’s animation, the client also plays an animation for the other player(s).

Edit: This can be achieved by the client creating a copy of each player’s character, then when you need to play a two-player animation, the client switches the other player’s character with the copy of their character and then plays the animation on the copy. I recently did something like this shown below. You can see the client creating NPCs on which it plays the animations. In a live server these NPCs are modified to look like other players in the server.

the main point of this post was to figure out how to make attack moves that can go to 2+ players, meaning the move itself can damage or ragdoll nearby players (depending on the move)

if i had a damage function for an animation connected to a remoteEvent it would be able to be abused.

The post you linked is still running animations on the client. The post says that the “server plays the animation” but what he actually meant was that the server only messages the client to play the animation, but the animation itself is still client-owned. An exploiter could also abuse CombatEvent if you forget to put the sanity checks that they mentioned, so overall the logic is the same.

Absolute worst case scenario you can try playing two versions of the same animation — one for the server (hit validation), and one for the client (instant visual feedback).

Even if it wasn’t possible for a feature to do server-side checks with client-side visuals, sometimes you have to make sacrifices in order to make the player experience better. That’s why Roblox gives network ownership of the player’s character to the client even though that creates vulnerabilities, because visual effects need to be played on the client in order to have zero delay. With that being said there’s almost always a way to sanity check on the server while making effects fully client-sided.

Even if it’s impossible, I would personally prefer the occasional exploiter who gets vote kicked out of the server anyway than make a laggy experience for my players.

In my post, I mentioned two ways you can handle animations.

  1. on the server
  2. on the client

They’re both really similar w/ pros and cons. If you run it on the client, you get instant visual feedback, run it on the server, then it’s laggy for everyone, but still equally laggy (more or less depending on ping.) In the end, it comes down to personal preference. If you were to play animations on client, I would just recommend handling all the processing in the client as well (hit detection, vfx, sfx, etc.) and just tell the server to make the enemy take damage or replicate effects, etc.

1 Like

you can use pivot points to position them correctly, basically all you need to do is make a part and set it as the center of the whole animation then you just need to animate the 2 humanoids. to play it in-game all you need to do is position the 2 characters based on the pivot and then play the animation on both humanoids at the same time.

this is what i did for my moon VFX exporter plugin. you can check out the code i made if you want. it’s open-source.
Moon VFX Exporter

1 Like

thanks, this is mainly what I was looking for regarding cutscene moves i’ll start using pivot points in that manner

do you know how I could achieve active moves though?

(example: grab a player and move forward 3 different times where the camera is facing)

i don’t need any code i just need some sort reference, in my original post I was thinking i could use body aligns to keep the enemy locked in front of the player while the player is moves by a linearvelocity

for grabbing the player you can attach the target player head to the hand of the one doing the moves then make the target player massless so the one doing the moves won’t glitch out because of physics stuffs.

after that you can apply alignposition and alignorientation and make them target an attachment that you put in front of the player. this will make the player go forward and stuff.

and to time all that you can use animation events.

NOTE : make sure to lock the Y & X rotation of the player that does the move to prevent funny stuff from happening.

1 Like

thank you for your time, I’ll try applying this logic to some of my moves now and i may get back to you if I have any issues.