Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago
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.

0
nvm I fixed it. Senor_Chung 210 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

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

0
That didn't work... Senor_Chung 210 — 10y
Ad

Answer this question