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

How can i make my gui stop at a certain size?.

Here is the code, again i am trying to make my gui stop after it has hit a specific size i use a while loop in my script and i try to break that loop once my gui has reached it's desired size but it keeps going past my intended size.

button = game.Workspace.button
isDown = false

button.ClickDetector.MouseClick:connect(function()
	if not isDown then
		isDown = true
		while isDown do
			wait(2)
 			script.Parent.Size = UDim2.new(script.Parent.Size.X.Scale-.1, script.Parent.Size.X.Offset, 		 		 		                	script.Parent.Size.Y.Scale-1, script.Parent.Size.Y.Offset)
			if script.Parent.Size == UDim2.new({-0.7, 150},{0, 30}) then -- having trouble around here
				 break
				end
			end
	else 
		isDown = false
		print("Door Down")
	end
end)

2 comments

0

It wouldn't indent properly.

0

There is no need for the '{}''s on line 10.

1 answer

UDim2.new({-0.7, 150},{0, 30})

This is one mistake i found. I've never needed to change the Size like that so i'm not sure if that's the whole problem, but try this instead:

UDim2.new(-0.7, 150, 0, 30)

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