Different Death Animations

First off, I’m not even sure this is possible. But what I’m trying to figure out is, is there a way to play different animations depending on which body part took damage? For example, Call of Duty has a separate animation for when the player is shot in the leg, torso, and head. So in roblox a player would be shot in the knee, and I would make an animation of where the player cripples around the knee, (falls to the side the knee is on or something.) Are there tutorials on YouTube or another platform? Or is it a simple code (which I doubt because I guess it has something to do with projectiles, but I don’t know I’m not a scripter.) If you can help, thanks! If not, I appreciate you reading to the end.

1 Like

This is more of a problem-solving skill, In order to solve a problem of this magnitude where there are no tutorials available you truly do have to be a scripter.

I’ll aid you step by step to show what a scripter would be thinking to solve this problem.

Firstly you need to make a gun in the first step and the most reliable way is through raycasting as it does not require the Roblox’s physics engine lol.

There are many tutorials on raycasting I’m pretty sure you research yourself.

But what else can you do with ray casting? How can you apply it to your problem?

well…

Wow raycasting does help with this as well.

As seen you can get a raycast result which we can access to gain what it hit as the hit part

--gets what was hit
local hitPart = Raycastresult.Instance

We can then find out what was hit by the part’s name from accesing the name property of the instance

-- if it hits head then the name would be "Head"
local hitName = hitPart.Name 

Are you starting to see where we can from this?

It’s a consecutive step by step problem to handle these types of problems. I suggest using a visual software to visualize the scripting logic behind the problem like so, as explained by @ThomasMGardiner in this post.

software is lucid chart btw if u wanna make ur own

After that, you can ask for help for what specific things scripting mechanism, logic, Instance needed to solve the problem which you ask here on the dev forums.

Maybe the logic to get what dealt the killing blow and animations will have to come separately as an entire other topic. Or you can research on your own by looking at other peoples post on scripting support and the all-mighty google especially animations lots of problems can occur there.

1 Like