Hello there i was making a hunger script but then i noticed that the hunger meter can go to above 100% how i can stop this number going up? this should be in line 25 to 28
local HG = script.Parent
local Text = HG:WaitForChild("Back"):WaitForChild("Text")
local Plr = game.Players.LocalPlayer
repeat wait() until Plr.Character
local Hum = Plr.Character:WaitForChild("Humanoid")
local MaxHunger = 100
local DecreaseRate = 3 -- 8 seconds = -1 hunger
local HungerValue
if Plr:FindFirstChild("HungerVal") then
HungerValue = Plr.HungerVal
HungerValue.Value = MaxHunger
else
Instance.new("IntValue", Plr).Name = "HungerVal"
Plr.HungerVal.Value = MaxHunger
HungerValue = Plr.HungerVal
end
HungerValue.Changed:connect(function()
Text:TweenSize(UDim2.new(HungerValue.Value/MaxHunger,0, 1,0), "Out", "Linear", .2, true)
end)
while true do
if HungerValue.Value >= 100 then
HungerValue.Value = 100
end
while wait(DecreaseRate) do
if HungerValue.Value - 1 >= 0 then
HungerValue.Value = HungerValue.Value - 1
end
if HungerValue.Value == 0 then
repeat wait(1)
Hum.Health = Hum.Health - 2
until HungerValue.Value > 0 or Hum.Health <= 0
end
end
end

2 comments
I'm confused do you have a gui for how much hunger you have?
yeah i have the gui!