Hello, Devforums!
I have a hunger bar, but when it goes all the ay down, you die instantly.
And i want it to well, remove the player’s hp each second.
All answers are helpful.
2 Likes
Hello! Could you provide the code that decreases the hunger? Are there any errors in the output?
1 Like
Hi!
There are no errors in the output and…
Here:
keep in mind when you do :BreakJoints()
it breaks all welds of the character, which kills it.
you wanna do
while task.wait() do
Character.Humanoid.Health -= 1
end
1 Like
Hello, i made an improved version of your code that works! Please use Scale to fill a bar
I’ll leave the model so you can see how i did it
local runService = game:GetService("RunService")
local frame = script.Parent
local speed = 4
frame.fill.Changed:Connect(function()
if frame.fill.Size.X.Scale <= 0 then
frame.Parent.Parent.Parent.Character:BreakJoints()
end
end)
while true do
if frame.fill.Size.X.Scale > 0 then
frame.fill:TweenSize(UDim2.new(frame.fill.Size.X.Scale - 0.1,0,1,0), "Out", "Bounce",0.5)
end
task.wait(speed)
end
2 Likes