Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED] How do I make the UI tween from left to right?

I don't know how to make the UI tween from left to right depending on the value of "CurrentEnergy"

-- Energy --
local CurrentEnergy = char:WaitForChild("CharacterManagement"):WaitForChild("CharacterStats"):WaitForChild("Energy")
local MaxEnergy = char:WaitForChild("CharacterManagement"):WaitForChild("CharacterStats"):WaitForChild("MaxEnergy")
------------

CurrentEnergy:GetPropertyChangedSignal("Value"):Connect(function()
	local healthChange = CurrentEnergy.Value/MaxEnergy.Value
	healthGui.EnergyBarUI.MainEnergy.AnchorPoint = Vector2.new(0.5, 0.5)
	healthGui.EnergyBarUI.MainEnergy:TweenSize(UDim2.new(healthChange,0,1,0),"In","Sine",0.05)
end)

This is what happens when I attempted to have the UI trying to go left to right: https://media.discordapp.net/attachments/833569929696509972/878152211182530570/BiggestFail.PNG

3 answers

Use anchorpoint. Set it to 1,0,0,0 and then it will increase towards the left and decrease towards the right, which is flipped.

2 comments

0

@AlexanderYar I tried to do that, but it keeps disappearing to the left. I'm not sure on what to do.

0

I mightve misundersrood your question

change

UDim2.new(healthChange,0,1,0)

to

UDim2.new(0,healthChange,0,1)

because you change offset it wont work, so you must change scale.

I just found out it was so simple... I just had to make "EnergyBarUI" Rotation 180 inorder to make it go left to right.

This discussion is preserved as it was. New answers, comments, and votes are closed.