Hello @Flauros1 ,
So what more exactly happens when you run this code? By the looks of it, it should add an instant force to the GameObject with the Rigidbody2D attached to it, in either positive or negative x axis.
What I usually do when faced with a coding mystery like this, is to break the issue down a bit.
What happens if you create a new GameObject, add a rigidbody2D onto that GameObject, and a script with only that knock back code, being executed on key down or something similar? Does it behave correctly?
Then you can either scale it even further back, or if it works, start adding back the pieces to see when the issue starts to appear again.
I’m guessing you have a function which moves the character in your fixedUpdate or Update (even tho it shouldn’t be in update) which zeros out the velocity on the x axis.
Just toggle it off when you are knocked back.
You can do it with a bool, state machine or whatever you want.