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

When the game menu is spammed, it breaks?

I'm finding bugs with this and I came across a bug where when you spam it it's possible to have both guis down at the same time even with a debounce. Also, when you press the button to close the About/Credits menu, it works in studio but doesn't work in-game. I'm completely clueless on why this is, so any help is appreciated.

Menu = script.Parent
Play = Menu:WaitForChild("Play")
About = Menu:WaitForChild("About")
AboutMenu = Menu:WaitForChild("AboutMenu")
Credits = Menu:WaitForChild("Credits")
CreditsMenu = Menu:WaitForChild("CreditsMenu")

PlayClicked = false
AboutClicked = false
CreditsClicked = false
ClickedWaitTime = 2

function PlayButtonClicked()
	if not PlayClicked then
		PlayClicked = true
		Play:TweenPosition(UDim2.new(0.5, 0, 1.05, 0), "InOut", "Quad", ClickedWaitTime)
		About:TweenPosition(UDim2.new(-0.15, 0, 0.45, 0), "InOut", "Quad", ClickedWaitTime)
		Credits:TweenPosition(UDim2.new(-0.15, 0, 0.55, 0), "InOut", "Quad", ClickedWaitTime)
	end
	wait(ClickedWaitTime)
	Menu:Destroy()
end

function AboutButtonClicked()
	if not AboutClicked and not CreditsClicked and not PlayClicked then
		AboutMenu:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "InOut", "Quad", ClickedWaitTime)
		wait(ClickedWaitTime)
		AboutClicked = true
	elseif AboutClicked and not CreditsClicked and not PlayClicked then
		AboutMenu:TweenPosition(UDim2.new(0.5, 0, -0.5, 0), "InOut", "Quad", ClickedWaitTime)
		wait(ClickedWaitTime)
		AboutClicked = false
	end
end

function CreditsButtonClicked()
	if not CreditsClicked and not AboutClicked and not PlayClicked then
		CreditsMenu:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "InOut", "Quad", ClickedWaitTime)
		wait(ClickedWaitTime)
		CreditsClicked = true
	elseif CreditsClicked and not AboutClicked and not PlayClicked then
		CreditsMenu:TweenPosition(UDim2.new(0.5, 0, -0.5, 0), "InOut", "Quad", ClickedWaitTime)
		wait(ClickedWaitTime)
		CreditsClicked = false
	end
end

Play.MouseButton1Click:Connect(PlayButtonClicked)
About.MouseButton1Click:Connect(AboutButtonClicked)
Credits.MouseButton1Click:Connect(CreditsButtonClicked)

2 comments

0

So many functions...

0

Im pretty sure u need to add a debounce so that it finishes opening or closing b4 processing another click

2 answers

Try making an Instance of a textbutton, put everything to zero, change the ZIndex to 10000 and make it invisible and everytime their is wait time then just make the Instance visible and then invisible later, Have fun and remember to accept answer.. :D

You could make a a textlabel then put a button over it, then when the play clicks the button the button is destroyed so they wont glitch it out.

1 comment

1

Not a textlabel....

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