✓ Accepted answer
You never call SetupGui, so add script.Parent.Humanoid.HealthChanged:connect(SetupGUI) to the, end of your script.
This will call your function when the humanoid's health changes, in other words it runs the function when a specific action occurs, in this case when the Humanoid's health changes.
Also you have to find the player who is damaging the gate so you can edit their gui. Right now you are editing the StarterGui which only changes the gui when the player respawns. To do this use a Touched event to call(run) a function that finds the player's Player in Players (that's a mouthful) and edits their gui, which is in PlayerGui. If you don't know how to do this just tell me :)
Finally do this to your if statements:
if diet <= --The Value you already have and diet>= --The next value you are checking for then
This gives a range of values to check so no change is skipped over.
As for gate not taking damage TakeDamage() which is used in the LinkedSword isn't working for some odd reason.
3 comments
Thank you good sir, i give you cookie if i ever meet you. :D
I just edited it.
Please accept my answer if you felt it was what you were looking for :)