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

How do i make a button that goes invisible then shows a different GUI when clicked?

Asked by 2 years ago
Edited 2 years ago

TeamGUI is the GUI to show if you click the button

local (TeamGUI) = game.Players.LocalPlayer.PlayerGui:WaitForChild("TeamGUI") local button = script.Parent.TextButton

button.MouseButton1Click:Connect(function()) (TeamGUI).Enabled = true end)
0
You didn't format it correctly, please look at the guidelines and also how to make a good question. Antelear 185 — 2y
0
You didnt format it as in you never even formatted it as a lua script, we cannot read the script nor can we help you while it's like this. Antelear 185 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Hey there!

I would recommend not going through the player's PlayerGui, and instead using more of a local sort of script. I'm blanking on what this term is called, sorry!

But anyways, I am assuming that the button is in a separate gui, just inside of a ScreenGui. I would write the script like this:

local openButton = script.Parent
local guiToOpen = script.Parent.Parent.Parent.Parent:WaitForChild("TeamGUI")
script.Parent.MouseButton1Click:Connect(function()
    openButton.Visible = false
    local frames = guiToOpen:GetChildren()
    for i = 1, #frames do
        frames[i].Visible = true
        wait()
    end
end)

Go ahead and change the guiToOpen variable to the correct amount of ".Parents"

I hope this helps, and please let me know if you have any further questions!

0
i dont know how many .parent to do. jakubiscool5 8 — 2y
Ad

Answer this question