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

A TexButton that appear and disappear a GUI?

Asked by 4 years ago
Edited 4 years ago

I have problem with that script:

script.Parent.MouseButton1Click:connect(function()
    script.Parent.Parent.Frame.Visible = false
end)

I have been able to make it disappear, but now I need it to reappear without the player restarting.

1 answer

Log in to vote
1
Answered by
Rinextel 291 Moderation Voter
4 years ago
Edited 4 years ago

Hey, Bryan! Great question!

You can do this by using a debounce or a more simpler way:

local Frame = script.Parent.Parent.Frame

script.Parent.MouseButton1Click:Connect(function()
    if Frame.Visible == true then --So if the value is true then it runs the code below!
                --Code here
elseif Frame.Visible == false then --However, if the frame is not visible then it runs this code instead! Pretty simple! 
                --Code here
    end
end)

You can also do this by using a debounce, which you can learn about here: https://developer.roblox.com/en-us/articles/Debounce

Be sure to upvote and mark as solution is it helps you! Happy scripting

Ad

Answer this question