I have made a thirst and hunger bar, but their bars do not change. I am getting no errors in the output either. Can someone tell me what I am doing wrong?
Player = script.Parent.Parent.Parent.Parent Character = Player.Character Thirst = 100 Hunger = 100 while true do script.Parent.frameThirst.statThirst.Size = UDim2.new(Thirst*0.01, 0, 1, 0) script.Parent.frameHunger.statHunger.Size = UDim2.new(Hunger*0.01, 0, 1, 0) script.Parent.frameHealth.statHealth.Size = UDim2.new(Character.Humanoid.Health*0.01, 0, 1, 0) wait() end while true do Thirst = Thirst -1 Hunger = Hunger -1 wait(3) end
Your script never reaches the while loop at the bottom. This can be fixed by invoking a function to update the GUI, instead of using a while loop. Script:
local Player = script.Parent.Parent.Parent.Parent local Character = Player.Character local Thirst = 100 local Hunger = 100 local function updateGui() script.Parent.frameThirst.statThirst.Size = UDim2.new(Thirst*0.01, 0, 1, 0) script.Parent.frameHunger.statHunger.Size = UDim2.new(Hunger*0.01, 0, 1, 0) script.Parent.frameHealth.statHealth.Size = UDim2.new(Character.Humanoid.Health*0.01, 0, 1, 0) end while true do Thirst = Thirst -1 Hunger = Hunger -1 updateGui() wait(3) end