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

Help with gui popping up?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

When I click this TextButton, a frame goes away. But the TextButton stays but changes text. I would want to click the TextButton again and then that frame pops up again.

script.Parent.MouseButton1Down:connect(function()
    script.Parent.Parent.Parent.Frame.Visible = false
    script.Parent.Text = "<<"

end)

2 answers

Log in to vote
1
Answered by
NotSoNorm 777 Moderation Voter
8 years ago

we define it as out

local out = true
script.Parent.MouseButton1Down:connect(function()
    if out then
        out = false
        script.Parent.Parent.Parent.Frame.Visible = false
        script.Parent.Text = "<<"
    else
        out = true
        script.Parent.Parent.Parent.Frame.Visible = true
        script.Parent.Text = "<<" --edit the text to the out position text
end)
Ad
Log in to vote
1
Answered by 8 years ago

You need an if statement. In your case:

script.Parent.MouseButton1Down:connect(function()
    if script.Parent.Parent.Parent.Frame.Visible == true then
        script.Parent.Parent.Parent.Frame.Visible = false
        script.Parent.Text = "<<"
    else
        script.Parent.Parent.Parent.Frame.Visible = true
        script.Parent.Text = ">>"
    end
end)

Answer this question