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

Why isn't the Gui going to the correct place?

script.Parent.AutoButtonColor = false
plr = game.Players.LocalPlayer
menu = plr.PlayerGui.Menu.ScrollingFrame
debounce = false
function onClick()
	debounce = true
	if menu.Position == UDim2.new(0,0,0,0) then
		for i = 1,10 do
			wait()
			menu.Position = menu.Position - UDim2.new(.03,0,0,0)
		end
		script.Parent.Text = "Open"
	else
		wait()
		for i = 1,10 do
			wait()
			menu.Position = menu.Position + UDim2.new(.03,0,0,0)
		end
		script.Parent.Text = "Close"
	end
	debounce = false
end
script.Parent.MouseButton1Click:connect(onClick)

it works the first two times you click it, but after that, does the second for loop when it's supposed to do the first for loop.

1 comment

0

nvm I fixed it.

1 answer

For the second for loop, change the variable and see if that works.

1 comment

0

That didn't work...

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