I made a thirst meter that kills you if you don't find water and drink it before it goes to 0, the problem is it keeps killing you after you died once, forcing people to rejoin or leave in confusion, I want it to reset once you die, any tips? This is the script that is supposed to kill you when you run out of thirst.
s = require(workspace.Settings);
screen = script.Parent;
status = screen.Status;
plygui = screen.Parent;
player = plygui.Parent;
thirst = player.Thirst;
dr = player.DehydrationRate;
tt = player.TotalThirst;
thirstGui = status.Thirst;
thirstBG = status.ThirstBG;
while wait(1) do
if thirst.Value > dr.Value then thirst.Value = thirst.Value - dr.Value; else thirst.Value = 0; end;
if thirst.Value > tt.Value then thirst.Value = tt.Value; end;
tprog = thirst.Value / tt.Value;
thirstGui.Size = UDim2.new(thirstBG.Size.X.Scale, 0, thirstBG.Size.Y.Scale*tprog, 0);
thirstGui.Position = UDim2.new(thirstBG.Position.X.Scale, 0, thirstBG.Position.Y.Scale+thirstBG.Size.Y.Scale*(1-tprog), 0);
end;
if player.Character then
char = player.Character;
if player.Character:FindFirstChild("Humanoid") then
human = char.Humanoid;
human.Health = human.Health - math.random(s.killRate.low, s.killRate.high);
human.WalkSpeed = 4 + 12 * human.Health / human.MaxHealth;
if human.Health < 0 then
human.Health = 0;
end
end;
end;

4 comments
I think you have to add a return after line 27
Still nothing, thanks for trying to help.
Maybe try and setting the Thirst Value to normal after him being killed?
wait() should NOT be a condition.