Hey there! I am a bit new to scripting and I've been trying to make a thirst script. Here's how it is so far:
Thirst = 100 player = game.Players.LocalPlayer.Character if Thirst <= 50 then game.Players.LocalPlayer.PlayerGui.ThirstWarn.Thirst2.Visible = true else game.Players.LocalPlayer.PlayerGui.ThirstWarn.Thirst2.Visible = false end while Thirst > 0 do wait(2) Thirst = Thirst - 10 end while Thirst == 0 do wait(2) player.Humanoid.Health = player.Humanoid.Health - 10 end
It was going well, the thirst would decrease and then the health would start decreasing aswell. But I wanted to make it better. So I added a GUI with the following text: "You are thirsty!". I wanted this GUI to appear when the thirst was below 50. To do that I made this:
if Thirst <= 50 then game.Players.LocalPlayer.PlayerGui.ThirstWarn.Thirst2.Visible = true else game.Players.LocalPlayer.PlayerGui.ThirstWarn.Thirst2.Visible = false end
But whenever I try to run the game, it just crashes. What's wrong? D: