I am building a game in which there is a player ball and an enemy ball i want a script that detects who has the higher velocity and adds to a percentage based off who has the higher velocity, and the percentage increases their knockback by the percentage.
I can give you the pseudocode, but it will be valuable lessons for you to learn the ins and outs of the physics system.
if(OtherBall.Velocity > My.Velocity)
{
difference = Otherball.Velocity - My.Velocity
Myself.AddForce(-velocity * difference);
}