Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

created a Food + Hunger script following a tutorial but nothing works, help?

Asked by 3 years ago

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)

Answer this question