i cant drag my image in the inspector when i use the code public image how can i fix this

this is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class healthsystem : MonoBehaviour
{
private int health;
public int health_max;
// public if you want to drag your text object in there manually

the part here doesn’t work so yeah how can i fix this
public Image bar;

private void Start()
{
    health = health_max;
   
   
}
void Update()
{
  if (health <= 0)
    {
        Destroy(gameObject);
    }   
}

public void TakeDamage(int damage)
{
    health -= damage;
    bar.fillAmount = health / health_max;
   
    //bar.localScale = new Vector3(1/(health/damage)f, 1f));
}

}

any suggestions?

int can not hold an image it is just a number. You need it to be an image. You don’t even have a variable set up to hold the image in the code you posted. Oh wait there it is you need to click code instead of just pasting into this editor.

Try Sprite instead of Image.