I want my bullets to do damage.

So I made a gun that fires physical projectile (a bullet). I also made a value for my enemy health. Basically what I want is that when my enemy gets hit by my bullets, he loose a little bit of health. If anyone could help me with this, I owuld be grateful.

Thanks

ProTip: Use Google

I’m also going to leave this here:

Create an script for the player with a float variable called life, and copy this code:
void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == “blt”)
{
life -= 10;
}
Check();
}

void Check()
{
if (life <= 0)
{
// Do something when the players die.
}
}

Add “blt” to your bullet tag. Add a rigidbody to your bullet.

You might be good to go.