Hello, (if you saw my last post, I am just letting 2 posts run at once. I will answer to both of them)
I wanted to know how to hide gui. Lemme elaborate:
Like games Phantom Forces, Arsenal, they have a system where they hide their gui when you have your weapons equipped. I want to do this to create more screen area for GUI. Such as custom health and stamina.
If you know, anything helps.
3 Likes
Well, you can get the screen gui object and set Enabled to false. If there are frames under it, you can set Visibility = false.
local playerService = game:GetService("Players")
local childWaitTime = 10
local function disableGui()
local localPlayer = playerService.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui", childWaitTime)
if playerGui then
local screenGui = playerGui:WaitForChild("Your screen GUI name here", childWaitTime)
if screenGui then
screenGui.Enabled = false
end
end
end
It must run on the client in a ClientScript.
1 Like
You want to Uncheck the Enabled property of a ScreenGui instance to hide everything underneath the ScreenGui.
Example:
-- To show gui
ScreenGui.Enabled = true
-- to hide gui
ScreenGui.Enabled = false
To add on to this, most gui elements support the Visible
property.
Frame.Visible = false
task.wait(5)
Frame.Visible = true
1 Like
so does this still show the tools gui but i just have to cover it? If so, id rather just make it not visible at all.
Are you talking about Roblox’s CoreGui for tools and gear, or do you mean a custom Gui that you’ve made yourself?
If it’s the former, you can look into SetCoreGuiEnabled.
CoreGui. I will look into it, thanks!
Yeah, the way to disable the backpack/tools gui is:
game:GetService("StarterGui"):SetCoreGuiEnabled(false)
In this case, you’d probably want to specify the backpack only:
game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
Didnt work for some reason, do i have to put this script somewhere?
Using the SetCoreGuiEnabled function requires a LocalScript. Attempting to use a server script won’t work. If it is a LocalScript and it isn’t running try putting them in these containers: StarterGui, StarterPlayerScripts inside the StarterPlayer and the ReplicatedFirst service.
Run the code @MightyDantheman suggested, inside a LocalScript that is enabled.
did that already. but ill put it in startergui
1 Like
Everything that’s under the specified GUI is hidden… Frames, everything.
Oops I was in a rush, didn’t realize I forgot the first parameter
1 Like