Hello! So I’ve been currently working on a PVP/Rp game, I’m fairly new to scripting but have learned the basics and intermediate levels there are for scripting. I want to create a skill where a player can absorb the health of another player, this works if the player is in close proximity and clicks the correct keybind then both players will be teleport right next to each other, the player absorbing the health will have an animation playing which is their arm touching another players shoulder with some glowing particle effects. Both players will be unable to move. My problem is that I want to make it so that this process can be interrupted. Therefore another skill is added which is a telekinetic push. How may I make it so that if another player pushes or interrupts this action the player can stop playing the animation, and all effects of these actions are nil? I’m currently thinking of checking a player’s position and if the player’s position has changed (due to telekinetic push ability) all effects are nil, however, I’m not sure if this is the most effective way or if it’s a viable solution. Thank you for any responses in advance.
If you are using Humanoids/AnimationControllers/Animators then you can call
Humanoid:GetPlayingAnimationTracks() to see which animation tracks are currently playing. AnimationTracks have an Animation property that tells you which animation it corresponds to so you can check if any of the animation tracks are playing the animation you are looking for - in this case, whatever your health abosrbing animation is. (AnimationController and Animator objects both have this method as well if you are using those instead).
I integrated some version of this and it works really well, Thank you!