How to fix this gui issue

I was wondering how I could quickly make this guis corner still look rounded at the end of the tween.

video:


It becomes a square after the tween is done because the tween keeps going.

2 Likes

I have no idea what order your things are in, but you can try changing the zindex of the dark gray border to something higher

1 Like

Bruv than it will cover the entire progress gui up.(the one the tweens)
image

1 Like

Can you provide your script at least then

1 Like
local bar = script.Parent
local randomnumber1 = Random.new()
while true do
	task.wait(Random.new():NextNumber(0.3, 2))
	local randomsize = randomnumber1:NextNumber(0.01,0.2)
	bar:TweenSize(bar.Size + UDim2.new(randomsize, 0, 0, 0), 'InOut', 'Quart')
end
1 Like

Probably the random value you are getting makes bar more than 1 scale. Remove random and set scale to 1 to see if it works good. If this doesn’t help you can tween it until 0.98 or 0.97 scale.
You probably need to make loading bar to not increase by random.

1 Like

You can use math.clamp to make sure it doesnt go above the limit you set. Example:

local bar = script.Parent
local randomnumber1 = Random.new()

-- change these to your liking:
local minScale = 0
local maxScale = 1

while true do
	task.wait(Random.new():NextNumber(0.3, 2))
	local randomsize = randomnumber1:NextNumber(0.01,0.2)
	local newSize = UDim2.new(math.clamp(bar.Size.X.Scale + randomSize, minScale, maxScale), 0, 0, 0)
	bar:TweenSize(newSize, 'InOut', 'Quart')
end
1 Like

I get this:


Also, you made an error at the variable randomsize, you said later to add randomSize

I have to go to sleep.

You put the Y scale at 0 in the script you posted before I replied so I assumed you were scaling Y with another method. Which means in the script I posted, Y scale should be 1 instead of 0.

local newSize = UDim2.new(math.clamp(bar.Size.X.Scale + randomSize, minScale, maxScale), 0, 1, 0)

1 Like

This is pretty much what math.clamp does. It prevents a value being set greater than the allowed maximum.

For example: print(math.clamp(10, 1, 5)) will print 5.
10 is the value you input. 1 is the minimum allowed. and 5 is the max allowed.

Sorry, the last one didn’t work at all :see_no_evil: but I tested this one and it does work!

local bar = script.Parent
local randomnumber1 = Random.new()

while true do
	
	task.wait(Random.new():NextNumber(0.3, 2))
	local randomsize = randomnumber1:NextNumber(0.01,0.2)
	local newSize = bar.Size + UDim2.new(randomsize,0,0,0)
	
	if bar.Size.X.Scale + randomsize > 1 then
		
		newSize = UDim2.new(1, bar.Size.X.Offset, bar.Size.Y.Scale, bar.Size.Y.Offset)
		
	end
	
	bar:TweenSize(newSize, 'InOut', 'Quart')
	
end

I’m not quite sure, but try to make your white bar not go beyond the light gray on the x. So it just stops at the edge of the dark gray frame. As shown in the picture (if it helps somehow)
image

Another possible solution would be setting your ZIndex’s like this:
Light gray: 1
White bar: 2
Dark gray: 3

If I made the dark gray bar have a ZIndex of 3, then it would completely cover over the light gray and white.