How would I make a Magnetic Repel

I can do the magnetic attraction, but I’m having trouble trying to make a repel, is there a way that I could make it? (I’m using key presses to attract and repel.)

How are you making it attract? If you are applying a force towards the magnet for attraction, then use the negative value of that force to repel.

Thanks, I will try doing this.

It works if the player is on the right of the object, but if the player is on the left of the object, it attracts the object for some reason, how would I fix it?

Are you using -1 * Variable(forceVariable) to get the reverse force?

Can you screen snip how you are doing it? That will let us give better advice rather than just guessing how you’re doing it.