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

When the game menu is spammed, it breaks?

Asked by 6 years ago

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)
0
So many functions... Macoryx 0 — 6y
0
Im pretty sure u need to add a debounce so that it finishes opening or closing b4 processing another click Wafflecow321 457 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

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

Ad
Log in to vote
0
Answered by
HjmanYT -1
6 years ago

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
Not a textlabel.... greatneil80 2647 — 6y

Answer this question