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

How To Give Players (Clients) The Ability To Show & Hide Gui?

Asked by 6 years ago
Edited 6 years ago

This is what i tried, but failed hard hahaha then, realized if this did work my button would be hidden and then the players wouldn't be able to see the button to show the gui again....is it even possible to do this?

local hgui = script.Parent
local gui = game.StarterGui.ScreenGui

hgui.MouseButton1Click:Connect(function()
    gui.Enabled = false
end)

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

First of all, StarterGui is just a storage for guis which are later cloned into PlayerGui, so modifying the one inside there won't do anything, You need to modify the already cloned one.

Second of all, you don't have to hide the entire gui. You can hide the main frame, but for example keep a button which let's you open the gui again.

local gui = script:FindFirstAncestorOfClass("ScreenGui") --feel free to replace with the actual path
local button = script.Parent

local main = gui.Frame --replace this

button.MouseButton1Click:Connect(function()
    main.Visible = not main.Visible --this will toggle the state between true and false
end)

0
Thanks for the code, has to modify it to match my names. I also, came across an issue that was making my frame be visible open run. It was an easy fix just had to uncheck the visible box within the frame settings hehe.... ultraplage 11 — 6y
Ad

Answer this question