Ok so I have two issues with my game involving pushing players.
Issue 1: When a player gets ragdolled they get pushed away from the person who hits them.
the direction is determined by the lookvector of the humanoidrootpart of the person who hits them.
this is an issue because if I hit someone then turn around they will get pulled towards me as they get ragdolled rather than pushed away. How can I make it so the victim of the attack ALWAYS gets pushed away no matter where the attacker is facing?
Issue 2: I reverted an update where hitting players slightly pushes them back due to a problem.
I did the same thing where it got the lookvector of the attacker and the same issue occured as ragdoll however there was also ANOTHER issue.
dont mind the poor drawing but the red is the attacker and the blue is the person getting hit. the black line is where the attacker is facing. if the black line is even slightly off center the person hit gets pushed back + to the side a little bit which is a problem. I want it to be a direct push straight rather than sideways. (the green line indicates where the victim would get pushed as the black line is slightly off-center, and I obviously dont expect people to attack on-center perfectly)
All help is greatly appreciated! Should be a simple problem to fix.
You can use what @koziahss posted to get a vector facing the hit player’s character from the attacker, however for the number you multiply the unit vector by it needs to be in the thousands for the character to be nudged.