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

0

Is this your whole script?

0

yes

0

put the if inside of the while loop

0

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.

0

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^