Tween on GUI does something odd on the first instance, behaves normally after

Putting this here because the issues only started happening when I added the code for the tween - thinking I just don’t understand something.

The very first time this tween is called to act, it makes the health bar an odd size.

However, when the mouse is no longer targeting something, then finds a new target, everything behaves normally.

Here are the default properties of the progress bar being changed:

And this is the code actually doing the changes:

local function LTweenSize(Frame, EndSize, Duration)
		Duration = Duration or .1
		Frame:TweenSize(
			EndSize,
			Enum.EasingDirection.InOut,
			Enum.EasingStyle.Linear, Duration, true)
end

local function UpdateHealthGauge(target)
	bottom.Visible = true
	targetName.Text = target.Type.Value
	hpBar.Text = target.Health.Value.."/"..target.MaxHealth.Value
	LTweenSize(Barback, UDim2.fromScale(target.Health.Value/target.MaxHealth.Value, .63), .1)
end

Am I doing something incorrectly? Is it because my size uses offsets but the UDim2 is from scale (tbh I really don’t understand UDim2 very well).

I was using a deprecated Tween for one, and for 2 it was because I was using FromScale instead of From Offset. Fixed!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.