How to create damage knockback?

I’m making a game in which I have a custom HP system. When a player loses some of this I am hoping for them to be pushed up and back slightly in the opposite direction of that they are facing. How could I achieve this? I was thinking maybe with a bodyforce or velocity but i’m not sure how I would have it propel in the opposite direction every time

You could make an animation of knockback and play it on the character or use CFrame to get the Vector3 position of the character and quickly remove 0.1 studs on the X axis inside a while true do loop until the player has gone back 3 studs (or however many studs you want). Removing 0.1 studs quickly will make it seem as though its happening in real time and not the player being teleported for knockback.

1 Like