Problems with RigidBody2D.AddForce()

Hey guy! I’m new to the forums so excuse me if I selected the wrong category.
I’m having a problem with the RigidBody2D.AddForce() function, when I try to add a force the Y force is added correctly, meanwhile the X one does’t do anything.
I’m trying to do a knock back system for my character, here is the script where the knockback is taking place.

#pragma strict
import UnityEngine.UI;

var health : int = 100;
var mana : int = 100;
var HealthBar : GameObject;
var ManaBar : GameObject;
var ManaRegenFactor : int = 1;
var HealthRegenFactor : float = 0.3;
var regenerating = false;
var hitTimeEffect : float = 0.2;
var knockbackX : float = 3;
var knockbackY : float = 3;

function Start () 
{

}

function Update () 
{
	HealthBar.GetComponent(Slider).value = health;
	ManaBar.GetComponent(Slider).value = mana;
	if(mana < 100 && !regenerating)
	{
		ManaRegen();
	}
	if(health < 100 && !regenerating)
	{
		HealthRegen();
	}
}

function ManaRegen()
{
	regenerating = true;
	yield WaitForSeconds(1);
	mana+=ManaRegenFactor;
	regenerating = false;
}
function HealthRegen()
{
	regenerating = true;
	yield WaitForSeconds(10);
	health+=(HealthRegenFactor*10);
	regenerating = false;
}
function damageEffect()
{
	rigidbody2D.AddForce(Vector2(knockbackX,knockbackY), ForceMode2D.Impulse);
	var G : GameObject = transform.GetComponent(SpriteRenderer).gameObject;
	var normalColor: Color = G.renderer.material.color;
	G.renderer.material.color = Color.red;
    yield WaitForSeconds(hitTimeEffect);
    G.renderer.material.color = normalColor;
}

I hope you can help me.
Thanks in advance!
Alejandro Ayala

Check knockBackX in the Inspector. It’s probably 0 (did you make it, then add the =3 later?) Inspector values “win” when they are different from the starting values in the code.