Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

can i make animations triggered by other players?

Asked by 5 years ago

for example if a player punches another player the play gets knocked back

0
Likely so. You could probably have some pre-made hitboxes and the hitboxes are in front of the player, and if a player is inside the hitbox and the tool is used or the key is pressed, it will trigger the animation for any humanoid in the players' "punch hitbox" Stycon 30 — 5y
0
how would i make a hitbox EzireBlueFlame 14 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Hi! I'm BlackOrange and I'm here to help!

In scripting, you may have noticed that there are many ways to do 1 thing. Some are just easier, more efficient while others are pointless but still works.

In this case, I present you 2 ways to do this. (Assuming you know how to make animations, use them in scripts and etc)

  1. HealthChanged. One of the best ways to check if you are being damaged is HealthChanged. This WILL require some mathematical knowledge to change it so that you only play the animation when TAKING damage rather then REGENERATING health. If you are going to go with this then:

here is your template:

-- a local script in StarterCharacterScripts
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local CurrentHealth = Char.Humanoid.Health -- you want to see the difference so you would have a variable of the one they started with

Char.Humanoid.HealthChanged:Connect(function(Health)
    -- Tip you will have to update the CurrentHealth variable later
end)
  1. Playing the animation when damaging

This one is easier, it requires less mathematical knowledge overall. Basically during your "Punch" and when you deal damage. You want to probably use :GetPlayerFromCharacter and then get their character's HUMANOID and load the animation in. This is more in sync and neater overall.

There is no template since this would be based on your script.

Hopefully, this gave you a big idea on how you can do this.

Best of luck developer!

Ad

Answer this question