I have made and scripted a customization system, but what is annoying me, is the fact that the chat system is on top of the customization system. I was wandering if there was a way I could make a player not see the chat, until a button is pressed.(Btw, if you could do that for the leaderboard too, that would be GREATLY APPRECIATED . Thank you very much.
Is there a way for me to make chat invisible until a button is pressed?
2 answers
Roblox has a service called StarterGui which you can use the function :SetCoreGuiEnabled on. This will then give you the option to set specific parts of the core gui.
http://wiki.roblox.com/index.php?title=Disabling_parts_of_the_game_interface
Using this, we can create a module in our script to have functions for disabling/enabling parts of the interface:
local hud = {}
-- hud module
-- By Scarious
print("Loading hud module")
do
local sGui = game:GetService("StarterGui")
function hud:enableLeaderboard(on)
sGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, on)
end
function hud:enableHealth(on)
sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, on)
end
function hud:enableBackpack(on)
sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, on)
end
function hud:enableChat(on)
sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, on)
end
function hud:enableAll(on)
sGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, on)
end
end
Now, 5 functions have been added:
-- hud:enableLeaderboard(true/false)
-- hud:enableHealth(true/false)
-- hud:enableBackpack(true/false)
-- hud:enableChat(true/false)
-- hud:enableAll(true/false)
for the purposes of this, we are interested with:
-- hud:enableLeaderboard(true/false)
-- hud:enableChat(true/false)
so, to disable the leaderboard and the chat at start we will use this:
local player = game.Players.LocalPlayer
function characterAdded()
hud:enableChat(false)
hud:enableLeaderboard(false)
end)
characterAdded()
player.CharacterAdded:Connect(characterAdded)
to re-enable it at any point, we will do as follows:
-- function for player clicking a button to enable leaderboard
hud:enableLeaderboard(true)
-- function for player clicking a button to enable chat
hud:enableChat(true)
That's about it, if you have any questions, feel free to ask. Note that this must be used in a local script (duh)
Or you can simply not use a module script because that is unnecessary.
local sgui = game.StarterGui
sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Playerlist,false)
--specify button path pls
button.MouseButton1Click:Connect(function()
sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)
sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Playerlist,true)
end)
1 comment
You can but I prefer declaring things I can use over and over again in a script.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you for the info, this will be very useful for my project