I have been searching all morning for a simple way to hide all of the tool icons on the screen. I am currently using the default Roblox backpack inventory system, and during certain cut-scenes, or dialog scenes I would like to hide the tool icons at the bottom of the screen.
Every search I do, I keep finding things about hiding the top bar, but nothing about the tool icons, or they bring up ways to disable the backpack when character spawns.
I need a way to toggle the icons at the bottom on and off, if that is possible, without removing everything from the backpack and character, then re-parenting them.
For this you can use the :SetCoreGuiEnabled() method of the StarterGui service, which takes care of all core (built-in) UI elements made by roblox, such as the leaderboard, the chat, and like in your case, the inventory.
local CoreGui = game:GetService("StarterGui") --the service
CoreGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) --this is the method disabling the backpack; you can see I set it to false, and chose the backpack
CoreGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false) --you can see you can disable other things, here is all of them https://developer.roblox.com/en-us/api-reference/enum/CoreGuiType
CoreGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) --and you can set it back by replacing false with true
I was under the impression that those commands would only affect how the screen was displayed when the character resets.
So are they able to be called locally on a running character and affect things already in the PlayerGui?
Hey, it seems you’re wanting to set the backpack core gui to false. To do this, you’ll do the following in a local script
local StarterGui = game:GetService("StarterGui")
To hide the tools, use the following line. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
To show the tools again, use the following line. StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
A hacky way of doing it, if you’re tools dont change, is to have a local script that checks user input, and a script in the character. In the character script, youd have an if statement that checks for player input from a remote function, and if input is 1, then it would force the tool to be held.
Have you tried disabling the gui, and tried to press a hotkey?
Making a custom backpack, or simply using Humanoid:EquipTool(objectvalue of a tool) and Humanoid:UnequipTools() I made something similar, let me show you script
repeat wait() until game.Players.LocalPlayer.Character
game:GetService('StarterGui'):SetCoreGuiEnabled('Backpack', false)
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Mouse = Player:GetMouse()
for _,button in pairs(script.Parent:GetChildren()) do
if button:IsA("ImageButton") then
Mouse.KeyDown:Connect(function(Key)
Key = Key:lower()
if Key == button.TSlot.Text then
if script.Parent.Visible == true then
if not Character:FindFirstChild(button.TName.Text) then
Character.Humanoid:EquipTool(Player.Backpack:FindFirstChild(button.TName.Text))
elseif Character:FindFirstChild(button.TName.Text) then
Character.Humanoid:UnequipTools()
end
end
end
end)
end
end
The following is more of a proxy hide solution in that it allows you to periodically hide/show the names & texture icons of tools while still allowing for those tools to be used.
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local backpack = player:WaitForChild("Backpack")
local tools = {}
local function hideTools(backpack, humanoid)
table.clear(tools)
humanoid:UnequipTools()
for _, tool in ipairs(backpack:GetChildren()) do
if tool:IsA("Tool") then
tools[tool] = {}
tools[tool].Name = tool.Name
tools[tool].TextureId = tool.TextureId
tool.Name = ""
tool.TextureId = ""
end
end
end
local function showTools(backpack, humanoid)
humanoid:UnequipTools()
for _, tool in ipairs(backpack:GetChildren()) do
if tool:IsA("Tool") then
if tools[tool] then
tool.Name = tools[tool].Name
tool.TextureId = tools[tool].TextureId
end
end
end
table.clear(tools)
end
task.wait(3)
hideTools(backpack, humanoid)
task.wait(3)
showTools(backpack, humanoid)