the progress bar goes over the size limit here is the script
local ClickArea = script.Parent.Parent.Parent.Parent.ClickArea
local sound = script.Parent.Parent.Parent.Parent.Sound
local progress = script.Parent
ClickArea.MouseButton1Click:Connect(function()
sound:Play()
if progress.Size == UDim2.new(0,562,0,28) then
progress:Destroy() return end
progress.Size += UDim2.new(0,70.25,0,0)
end)
The condition will never be met cause you’re not adding to the Y axis.
local x_max = 562
local x = math.clamp(progress.Size.X.Offset+=70.25,0,x_max)
progress.Size = UDim2.new(0,x,1,0) -- have the Y scaled at 1 for this scenario
if progress.Size.X.Offset == x_max then
progress:Destroy()
end
it’s better to do less an "<" rather than equal to "=" otherwise the script will exceed the limit
edit: oops my bad you should do greater than ">", and also adds the guy above me
yeah, looking back at what he was trying to do, not just his code (which was confusing) he was trying to make a progress bar, which adding to the Y is not needed so your solution should suffice.
Your issue is really that it’ll never see the size limit.
You made it compare to see if two UDim2 values are equal to each other, that’s three different values!
What you should do is replace this line:
With this one
What you should do is replace this line:
if progress.Size.X.Offset >= 562 then
UDim2’s are just two UDim values, and UDim values are just one offset value and one scale value
The names to the UDim2’s properties are “X” and “Y”, but the names to UDim’s properties are “Scale” and “Offset”. You can read up and Offset and Scale here.
Let me know if you are having any other troubles!