HowToRoblox

BarHandler

Jul 23rd, 2020
2,011
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.48 KB | None | 0 0
  1. local barBG = script.Parent
  2. local bar = barBG:WaitForChild("HungerBar")
  3.  
  4. local hungerAmount = barBG:WaitForChild("HungerAmount")
  5.  
  6.  
  7. local hungerFolder = game.ReplicatedStorage:WaitForChild("HungerFolder")
  8.  
  9. local hungerValue = hungerFolder:WaitForChild(game.Players.LocalPlayer.Name .. " Hunger")
  10.  
  11.  
  12. hungerValue:GetPropertyChangedSignal("Value"):Connect(function()
  13.    
  14.     hungerAmount.Text = hungerValue.Value .. "/100"
  15.    
  16.     bar.Size = UDim2.new(hungerValue.Value / 100, 0, 1, 0)
  17. end)
Add Comment
Please, Sign In to add comment