Basically what i’m doing is an oxygen system for my game, and i am currently making the oxygen bar.
The problem is i’m using TweenSize for the bar and this is my current script:
while true do
local hp = game.Players.LocalPlayer.Oxygen
script.Parent:TweenSize(UDim2.new(0, 15, 0, hp.Value), "Out", "Sine", 0.15)
It does work, kind of because when i go play and change the value this is what i get:
When it’s supposed to be the other way around.
Does anyone know how to fix this?
AnchorPoint of the GUI you’re resizing to
I recommend using humanoid.HealthChanged so you don’t have a running loop when you don’t need one.
I’m not doing a health bar, but i appreciate the advice
Sorry, I just saw hp and assumed it was health You can use Oxygen:GetPropertyChangedSignal(“Value”) instead so it only fires when the value changes
Fun fact, with value objects specifically you can just use
script.Parent:TweenSize(UDim2.new(0, 15, 0, oxygen), "Out", "Sine", 0.15)
Great! One less loop to lag my game.