Me and my friend were trying to make a healthbar script, but currently it shrinks from the right, while I need it to shrink from the left. I need this code to shrink from the opposite direction it shrinks from currently, any help?
local player2gui = player2:WaitForChild("PlayerGui")
local p2HealthBack = player2gui:WaitForChild("Gameplay"):WaitForChild("Match"):WaitForChild("Health Bars"):WaitForChild("Player2"):WaitForChild("HealthBack")
local healthBar = p2HealthBack.Health
local endSize = UDim2.new((Health / 100), 0, 1, 0)
local endPos = UDim2.new((Health / 100) / 2, 0, .5, 0)
healthBar:TweenSizeAndPosition(endSize, endPos, "In", "Exponential", 0.25, true, nil)
Changing the orientation to 180 might work. Try that before anything else. If that doesn’t work:
Are you able to provide a video? It should work, but maybe it is with the code. I doubt it, but maybe I guess. Can you provide the code for me, please?
Thank you, that’s all I needed to know, Plus, about the about the “glasses”, that’s not really believable and off topic, I was wondering about the Last Time it was edited because if the OP looks at it, they will think you said it first.
That’s a good reason, and I give credit to you since you said it first.
And yeah, I can see how it wasn’t believable, but it was true. Also very off topic, I agree; however, that is exactly why I don’t want to argue about it. There’s no point to
I didn’t mean to copy your suggestion. It was by complete mistake and I apologize.
Maybe something to do with the fact you are making the X size negative and changed the properties? “-(Health / 100)” and “-((Health / 100) / 2)”
I highly, highly doubt it. Especially since it worked before (before you changed the anchor point, position, and rotation), it just changed its size the wrong way. I’ve made something very similar before to what you have now, and it only changed size in the wrong direction. I just changed the anchor point & position that solved it for me. Same with every other health bar I’ve ever made that changes from left to right.
I would change the rotation back to 0, remove the negatives, keep the anchor point 1, 0 and the position 1, 0, 0, 0. Then make them positive, like this:
local endSize = UDim2.new((Health / 100), 0, 1, 0)
local endPos = UDim2.new(((Health / 100) / 2), 0, 0.5, 0)
Again, I highly doubt that’ll fix it; however, that doesn’t mean you can’t try. I’m just guessing random things at this point lol
I’ve never encountered your exact problem myself, so I’m more confused than anything. It’s anyways worked just fine for me.
If the frame is the exact same, just flipped or something, it shouldn’t cause any issues at all. It should work just fine. I can’t really think of why it could be happening
But even then, changing the frame shouldn’t cause much of an issue. Normally as long as you have the anchor point the way you want it, it’s fully functional no matter the size or rotation (rotation would change the way it changes size obviously, but that isn’t really much of a change. You’d just have to change the anchor point accordingly)