I made a script that moves a GUI from off-screen into the players view when a button is clicked. For some reason it takes 4 - 5 clicks before the GUI pops up. Is there a reason for this? Other then that it works fine.
IsOpened = false
Moving = false
local ExtraIconsOpen = script.Parent.Menu.Assets:WaitForChild("4")
local ExtraIconsFrame = script.Parent.Menu:WaitForChild("ExtraIcons")
ExtraIconsOpen.MouseButton1Click:Connect(function()
if Moving == false then
if IsOpened == true then
IsOpened = false
Moving = true
ExtraIconsFrame:TweenPosition(UDim2.new(1, -260, 1, -220), "InOut", "Quart", 0.5, true)
wait(0.1)
Moving = false
else
Moving = true
IsOpened = true
ExtraIconsFrame:TweenPosition(UDim2.new(1, -260, 1, -150), "InOut", "Quart", 0.5, true)
wait(0.1)
Moving = false
end
end
end)
If anyone could help me with this that would be great!

4 comments
My script isn't an intro it is a gui that pops up when a button is clicked, It just takes like 4-5 clicks before it works instead of 1 click.
Oh I see
Try removing the WaitForChild in the two variables. I did that and it worked fine.
I edited the orginial post