local Hunger = script.Parent.Hunger local HungerBar = script.Parent.MainFrame.HungerBar local Warning = script.Parent.Warning
Hunger.Changed:Connect(function() --Hunger*.01=1 Algorithm HungerBar:TweenSize(UDim2.new(Hunger.Value * .01,0,1,0)) if Hunger.Value > 100 then Hunger.Value = 100 end if Hunger.Value < 15 then Warning.Visible = false end if Hunger.Value == 0 then local Player = script.Parent.Parent.Parent Player.Character:FindFirstChild("Humanoid").Health = 0 end if Hunger.Value<15 then Warning.Visible = true --If you have a frame use Backgroundcolor3 else use Imagecolor3 HungerBar.BackgroundColor3 = Color3.fromRGB(190, 0, 0) end
local Loop = coroutine.create(function() while wait() do if Hunger.Value > 0 then wait(6) Hunger.Value -= 1 else break end end end)
coroutine.resume(Loop)