There's a solution:
YOU NEED TO USE GUI'S.
2 frames, 1 text label but not box under the frames. Red frame is "HungerBacking" and Green frame is "HungerBar". Green is the top-priority bar.
There is the code for the "Hunger" bar in your screen;
while true do
script.Parent.HungerBar.Size = UDim2.new(script.Parent.HungerBar.Size.X, script.Parent.HungerBar.Size.Y - 5)
wait(1)
end
PLEASE note that the size of the bar should be {0,10},{0, 100} for it to properly work.
Now to the textlabels.
- Turn on TextScaled
- Change the size to {0, 55},{0, 25}
- Set BackgroundTransparency to 1 (Turns off the boring black border)
- Make the TextLabel say "Hunger"
- For the position, set position to {0.015, 0},{0.187, 0}
Now we need a tool that upscores your Hunger. We'll call it "Fruit"
- Make a part called "Handle". Shortcut to rename: Press F2 during the instance focused (clicked).
- Add a script called "HungerAction".
- In the script, delete the default script and paste the following:
local Tool = script.Parent;
enabled = true
function onActivated()
if not enabled then
return
end
enabled = false
local hb = game.Players.LocalPlayer.PlayerGui.ScreenGui.HungerBarr.HungerBar
Tool.Handle.DrinkSound:Play()
wait(3)
local h = Tool.Parent:FindFirstChild("Humanoid")
if (h ~= nil) then
if (h.MaxHealth > h.Health + 5) then
hb.Size.Y = hb.Size + 5
h.Health = h.Health + 5
else
h.Health = h.MaxHealth
end
end
Tool.GripForward = Vector3.new(-.976,0,-0.217)
Tool.GripPos = Vector3.new(0.03,0,0)
Tool.GripRight = Vector3.new(.217,0,-.976)
Tool.GripUp = Vector3.new(0,1,0)
enabled = true
end
function onEquipped()
Tool.Handle.OpenSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
- This will hold up our hunger thing. Now to the next thing that edits the mouse cursor;
local MOUSE_ICON = 'rbxgameasset://Images/Large Cursor Click'
local RELOADING_ICON = 'rbxgameasset://Images/Large Cursor (1)'
local Tool = script.Parent
local Mouse = nil
local function UpdateIcon()
if Mouse then
Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
end
end
local function OnEquipped(mouse)
Mouse = mouse
UpdateIcon()
end
local function OnChanged(property)
if property == 'Enabled' then
UpdateIcon()
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Changed:connect(OnChanged)
This is gonna take up the icon.
Have fun using the Hunger GUI!
3 comments
maybe cause you are full
Try repeat wait() until v:FindFirstChild("leaderstats")
^ redundant. Same thing but worse as WaitForChild