GUI button issues

As you can see the issue is that if I press that button too fast the button disappears alongside my player lobby GUI. Here is my explorer and local script.

local PlayButtonFrame = script.Parent.PlayButtonFrame
local PlayButton = script.Parent.PlayButton
local Helpbutton = script.Parent.HelpButton
local SettingsButton = script.Parent.SettingsButton
local BackButton = script.Parent.PlayButtonFrame.BackButton

PlayButton.MouseButton1Up:Connect(function()
	
	PlayButton.Visible = false
	Helpbutton.Visible = false
	SettingsButton.Visible = false
	
	
	PlayButtonFrame:TweenPosition(
		
		UDim2.new(0.373, 0, 0.163, 0), 
		"Out", 
		"Quint", 
		1, 
		false 
		)

	
end)


BackButton.MouseButton1Up:Connect(function()
	
	PlayButtonFrame:TweenPosition(

		UDim2.new(0.362, 0, -0.9, 0), 
		"Out", 
		"Quint", 
		1,  
		false 
	)
	
	
	PlayButton.Visible = true
	Helpbutton.Visible = true
	SettingsButton.Visible = true
	
end)

LocalScripts name is “PlayButtonFrameLocalScript”

try use debounce to make button cant click fast?

3 Likes

My guess is that this might happen when you press the Play button before the Tween Position finishes. As the menu is already in the process of a tween position, it doesn’t start another one and so remains off screen. A debounce could help, or only make the Play button do something if the other menu’s position is where it should be (not currently being tweened)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.