Help with overly beautified healthbar system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to scale my “Overly beautified” healthbar system properly without having the guis smoosh down. ( Meaning no TweenSize… ) I am aware this is a TweenPosition related situation, and yes, the frames are all using “ClipsDescendant” enabled.

  2. What is the issue? Include screenshots / videos if possible!
    image
    image

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried solutions like 90/100 which is 0.9… but that’s not it… -0.9 would look very awkward and isn’t even close to what I am looking for. 10/100 shouldn’t be “Close to Max” either.

( Examples: )
90/100
image

10/100
image

Basically the gui is scaling in reverse?

local Player = game.Players.LocalPlayer
local CacheValues = Player:WaitForChild("CurrentValues")

CacheValues.CurrentStamina.Changed:Connect(function()
	main_unit.staminaunit["scale"]:TweenPosition(UDim2.new(-CacheValues.CurrentStamina.Value/CacheValues.MaximumStamina.Value, 0, 0, 0),"Out", "Sine", 0.2, true)
	main_unit.staminaunit["scale"].ImageLabel:TweenPosition(UDim2.new(CacheValues.CurrentStamina.Value/CacheValues.MaximumStamina.Value, 0, 0, 0), "Out", "Sine", 0.2, true)
end)


I am not asking for an entire script. Just a simple formula to solve my dilemma

Thank you!!!

2 Likes

Try changing the rotation and scale of the ui

Do position = 1 - staminaProportion. I.e. something like this

local Player = game.Players.LocalPlayer
local CacheValues = Player:WaitForChild("CurrentValues")

CacheValues.CurrentStamina.Changed:Connect(function()
	local staminaProportion = CacheValues.CurrentStamina.Value/CacheValues.MaximumStamina.Value
	
	main_unit.staminaunit["scale"]:TweenPosition(
		UDim2.new(1 - (-staminaProportion), 0, 0, 0), 
		"Out", "Sine", 0.2, true
	)
	
	main_unit.staminaunit["scale"].ImageLabel:TweenPosition(
		UDim2.new(1 - staminaProportion, 0, 0, 0), 
		"Out", "Sine", 0.2, true
	)
end)

Although, why can’t you use Size? Seems like it should work just fine

using size makes some weird behaviors to the gui like stretching, which is why I prefer position over size