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

Is there a way for me to make chat invisible until a button is pressed?

Asked by
AyeJude 41
7 years ago

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.

2 answers

Log in to vote
1
Answered by
Scarious 243 Moderation Voter
7 years ago

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:

01local hud = {}
02 
03-- hud module
04-- By Scarious
05print("Loading hud module")
06do
07    local sGui = game:GetService("StarterGui")
08 
09    function hud:enableLeaderboard(on)
10        sGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, on)
11    end
12 
13    function hud:enableHealth(on)
14        sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, on)
15    end
View all 28 lines...

Now, 5 functions have been added:

1-- hud:enableLeaderboard(true/false)
2-- hud:enableHealth(true/false)
3-- hud:enableBackpack(true/false)
4-- hud:enableChat(true/false)
5-- hud:enableAll(true/false)

for the purposes of this, we are interested with:

1-- hud:enableLeaderboard(true/false)
2-- hud:enableChat(true/false)

so, to disable the leaderboard and the chat at start we will use this:

1local player = game.Players.LocalPlayer
2 
3function characterAdded()
4    hud:enableChat(false)
5    hud:enableLeaderboard(false)
6end)
7 
8characterAdded()
9player.CharacterAdded:Connect(characterAdded)

to re-enable it at any point, we will do as follows:

1-- function for player clicking a button to enable leaderboard
2hud:enableLeaderboard(true)
3 
4-- function for player clicking a button to enable chat
5hud: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)

0
Thank you for the info, this will be very useful for my project AyeJude 41 — 7y
Ad
Log in to vote
2
Answered by 7 years ago

Or you can simply not use a module script because that is unnecessary.

01local sgui = game.StarterGui
02 
03sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
04sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Playerlist,false)
05 
06--specify button path pls
07 
08button.MouseButton1Click:Connect(function()
09    sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)
10    sgui:SetCoreGuiEnabled(Enum.CoreGuiType.Playerlist,true)
11end)
0
You can but I prefer declaring things I can use over and over again in a script. Scarious 243 — 7y

Answer this question