✓ Accepted answer
So i'll show you a fix.
Follow the following steps:
Step Zero (aka description what we need to do 1st): Do step 6. as 1st
- Make two frames, first is HungerBar (green color) and second is HungerBacking (red color). Their size is {0,5},{0,100} so it takes some long to get your hunger lower.
- Make a local-script called "ClickFunction".
- Insert following code there:
local clicker = game.Workspace.mouse.ClickDetector
clicker.MouseClick:connect(function()
game.Workspace.RemoteEvent:FireServer()
end)
- Create a serverscript called "HungerBar". Insert it into the "HungerBar" GUI instance.
- Insert the code;
while true do
script.Parent.HungerBar.Size = UDim2.new(script.Parent.HungerBar.Size.X, script.Parent.HungerBar.Size.Y - 5)
wait(1)
end
- You may get a stable hunger bar but you need to add a folder. Name the folder as "HungerBarr" (don't take care on a misspell), and put the serverscript and frames into the folder.
- Now we need to make an thing that increases hunger status to full. We will use a tool. Let's name it "Apple."
- Insert a red sphere called "Handle". Make it small.
- Paste the provided code here:
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 + 16) then
hb.Size.Y = hb.Size + 16
h.Health = h.Health + 16
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)
Tada! You get a working bar! Have fun :)
1 comment
The scripts seem to be trunctated