i tried to make it remove some value from something in a script and then if the value got to 0 the player dies
while true do
game.Workspace.HungerValue = game.Workspace.HungerValue.Value - 1
wait(5)
end
if
game.Workspace.HungerValue.Value == 0
then
player.health = 0
end

5 comments
Is this your whole script?
yes
put the if inside of the while loop
First of all, you're going to want to have the Value inside each player and secondly you haven't defined player. It doesn't know what player is or where to search for it.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^