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

How do I make it where when you click a GUI the rest are removed?

Asked by 10 years ago

When people click a GUI I want the others to go away.

0
Could you explain a little more? Like what GUI's would go away. samfun123 235 — 10y
0
All GUIs. FamousDoge 0 — 10y

1 answer

Log in to vote
0
Answered by
samfun123 235 Moderation Voter
10 years ago

The code to remove all other GUI's when you click on a button would be :

This code would be put in a LocalScript

keep = gui

button.MouseButton1Click:connect(function()
    for _,v in pairs(game:GetService("Players").LocalPlayer.PlayerGui) do
        if v ~= keep then
            v:Destroy()
        end
    end
end)

You have to define two things : keep : The GUI that the button is or just the one you don't want to be removed. button : The button you have to click to remove all the other GUI's

If you have any questions, concerns or just need some help with this PM me on ROBLOX!

Ad

Answer this question