AddForce bounce doesn't work

I have a 2D topdown game on which I want my player to collide with an object and bounces of it, kinda like sonic when he collides with on of this:

56906-sonic-bounce.jpg

I have a code that does that(below), However it doesn’t work. like my player doesn’t bounce of it, nothing. I even set “isTrigger” on my player but noting happen either. Could anyone help me with it?

using UnityEngine;

 using System.Collections;

 public class Bounce : MonoBehaviour {

   void OnTriggerEnter2D(Collider2D other) {

   if (other.tag == "player") {

GetComponent<Rigidbody2D>().AddForce (-Vector2.right * 500);

      }

   }

}

change this: GetComponent().AddForce (-Vector2.right * 500);

to this: other.GetComponent().AddForce (-Vector2.right * 500);

You are getting the rigidbody of the gameobject the script is attached to, which im guessing is the bounce pad. You need to get the rigidbody of the player so ‘other’.

Maybe that will help.

other.tag == “player”
Are you sure it shouldn’t be “Player” with a capital P?

if (other.tag == "Player") {
    other.attachedRigidbody.AddForce (-Vector2.right * 500);
}