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:
05 | print ( "Loading hud module" ) |
07 | local sGui = game:GetService( "StarterGui" ) |
09 | function hud:enableLeaderboard(on) |
10 | sGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, on) |
13 | function hud:enableHealth(on) |
14 | sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, on) |
17 | function hud:enableBackpack(on) |
18 | sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, on) |
21 | function hud:enableChat(on) |
22 | sGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, on) |
25 | function hud:enableAll(on) |
26 | sGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, on) |
Now, 5 functions have been added:
for the purposes of this, we are interested with:
so, to disable the leaderboard and the chat at start we will use this:
1 | local player = game.Players.LocalPlayer |
3 | function characterAdded() |
5 | hud:enableLeaderboard( false ) |
9 | player.CharacterAdded:Connect(characterAdded) |
to re-enable it at any point, we will do as follows:
2 | hud:enableLeaderboard( 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)