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

The GUI that my script tweens takes 4-5 clicks before it registers, How do I fix this?

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!

1 answer

-- Edit

IsOpened = false
Moving = false

local ExtraIconsOpen = script.Parent.Parent.Parent.Frame.TextLabel
local ExtraIconsFrame = script.Parent

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)

I did this with a couple of frames and it worked first click Try removing the WaitForChild it may be causing some problems

4 comments

0

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.

0

Oh I see

0

Try removing the WaitForChild in the two variables. I did that and it worked fine.

0

I edited the orginial post

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