I’ve been trying all solutions the whole day and i can’t figure it out how to update the hunger bar position while a tween is running and How to loop this tween.
I have another script but that’s a tool that if you eat food, it will set the value to 0, it did set the value of “HungerValue” but not of the position so it keeps running.
If you need more information, tell me some questions, i will respond to them!
Thank you for reading and trying to find a solution.
script.Parent:TweenPosition(UDim2.new(1, 0, 0, 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
60,
true
)
while wait() do -- Update the pos value
local pos = script.Parent.Position.X.Scale
local value = script.Parent.HungerValue.Value
pos = value
value = pos
if pos == 1 then
local h = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
if h then
h.Health = 0 -- If the hunger bar is empty, the player dies
end
end
end