How to make a custom bar

Hello! How would I make a bar and specify the maximum value and the initial value? I think it would be like this

0/100

you could use
math.Clamp

Create a Frame (this will be the holder), then create an ImageLabel or a Frame (whatever the bar is) underneath the holder. Scale it to 1, 0, 1, 0, and then adjust the 1 values - imagine that 1 is 100.

So, if you’d want to make a loading screen bar horizontally, you’d want to change the size to 0, 0, 1, 0, and then:

Holder.Frame.Size += UDim2.fromScale(.1, 0) -- the "bar" increases in width by 10/100
2 Likes
local TextLabel = script.Parent --reference to label

--suggested values
TextLabel.AnchorPoint = Vector2.new(0, 0.5)
TextLabel.Position = UDim2.new(0, 0, 0.5, 0)
TextLabel.Size = UDim2.new(0, 0, 1, 0)

local maxvalue = 100
local value = 10

local size = math.clamp(value/maxvalue, 0, 1) 

TextLabel.Text = value.."/"..maxvalue 
TextLabel.Size = UDim2.fromScale(size, 1) 
1 Like

How would i apply tween? ´- ´ñ

--goal, easing direction, easily style, time
local goal = UDim2.fromScale(size, TextLabel.Size.Y.Scale)
TextLabel:TweenSize(goal, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5)
1 Like