Damage depending on impact against a wall

Hello, fellow developers!

I’m currently trying to create an effect where if a player gets flung and if they do hit a part they’ll receive damage or completely die depending on the impact. I’m completely unsure of how to do this and I would appreciate it if you could help me.

(I have searched the DevForum for this topic but the posts I did find did not really help me.)

just FYI i just thought of this seconds before writing.

One easy way i can think of is using the BasePart.Velocity property. This can tell you how fast the part is moving (BasePart.Velocity.Magnitude = speed of part in studs per seconds) and you can use it to determine how much damage a player recieves. For more accurate speeds, since a part’s speed could become zero in an instant, you can take the average speed over the last .2 seconds of gameplay.

1 Like

Hmm, I’m a little bit more confused about how I would keep track of the player’s velocity if the player was being flung, and then detect it when it drops.

You could have an event that fires whenever the player is flung that connects a function to Runservice.Heartbeat that has all the logic checking and tracking the player’s velocity.