I am trying to make a "script" to stop people from killing cats in my Minecraft server (please don't ask why). My idea is that I want when you tame a cat, a diamond is added to the player's inventory. I tried to use "if entity" but it hasn't worked. Any ideas?

I tried using a scoreboard, expected when the scoreboard was updated, a "/give" command would run and give the current entity a diamond.

This is my code:

one time:

```
/scoreboard objectives add cat health

```

repeat:

```
/if scoreboard cat [health=0] give @s diamond

```