Essentially, I want to move this health bar back by position, not size. 100% health should look like this - at position {0, 0}, {0, 0}
. There’s clips descendants on the container frame so the bar doesn’t “pop out” out of its “visual container”, so I can’t make it position with X scale of 1 and go back from there.
What exactly are you trying to do? Make 100% (1) equal 0 and 0% equal 1?
Simple linear algebra. Take your inputs and outputs…
x = 1; y = 0
x = 0; y = 1
Solve for slope…
(1 - 0)/(0 - 1) = 1/-1= -1
And plug it in.
y = -x + 1
In Roblox, this’ll be…
local healthPercent = Humanoid.Health / Humanoid.MaxHealth
local value = -healthPercent + 1
If you’re trying to make it scale backwards/move from the right side of the element, you can set the AnchorPoint to (1, 0)
and the position to {1, 0}, {0, 0}
.
2 Likes
I’m bad at math.
More or less though, thanks. Though EmeraldSlash’s solution hit it right on (why didn’t I think of AnchorPoint? gg).
2 Likes