How to disable the backpack?

Hello everyone, today I modernized the backpack by creating another one, only the old backpack preset by roblox overlaps the new one. So I searched a bit on youtube how to disable it and I came up with this string of code to put in a “local script” in the “startergui”.

local StarterGui = game: GetService (“StarterGui”)
game.StarterGui: SetCoreGuiEnabled (Enum.CoreGuiType.Backpack, false)

The problem is that when I enter the game it doesn’t work and the backpack appears anyway, can you help me? thank you all

1 Like

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) this works fine , i placed on [Starter Gui]

9 Likes

Hi, thanks for the answer. I just tried to put yours on but it still doesn’t work I don’t know why.

1 Like

it needs to be a local script for the script to work im pretty sure

Yeah i know that it must be a local script

really this is kinda impossible… how it dind’t worked?

wait,
have you put it in Startergui?

try to use this
game.Players.LocalPlayer.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.BackPack, false)

1 Like

use “game.Players.localPlayer.PlayerGui” instead of “game.StarterGui”

1 Like

Not worked, i don’t know why. It’s a local script in startergui.

Try this code:

local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

If this still doesn’t work, I am not sure what the issue could be. But are you receiving any errors in the output?

1 Like

Sometimes directly doing this might not work, so there’s a better approach:

local coreCall do
	local MAX_RETRIES = 7

	local StarterGui = game:GetService('StarterGui')
	local RunService = game:GetService('RunService')

   
	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES do
			result = {pcall(StarterGui[method], StarterGui, ...)}
			if result[1] then
				break
			end
			RunService.Stepped:Wait()
		end
		return unpack(result)
	end
end



coreCall('SetCoreGuiEnabled', Enum.CoreGuiType.Backpack, false)

Note: Essentially what this code does is try disabling the backpack UI until it runs out of tries (you defined in MAX_RETRIES) or when it’s successful (no errors returned)

Important: Make sure this is a Local Script, and it’s in a place where it will be executed when a player joins a server of your game.

2 Likes

Create a local script in the StarterGui,

Write this on it:

local SG = game:GetService("StarterGui")
SG:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

And the code should work fine.

1 Like

place the local script inside ReplicatedFirst, if you already got the solution mark a solution or you have solved it say how you solved it and mark it as the solution

Im 99% sure you have some other script enabling the backpack every frame, check your other scripts that you think might be doing this, I had this same problem.

I’m having the same exact issue, I recently tested a backpack ui system and it works in other studios but not the studio I want. Is there any specific way to check for a script interfering?

You could loop through every script in the game and check if the script’s source contains “:SetCoreGuiEnabled”. If it does, you can check the script and see if it is enabling the backpack.

for i, v in game:GetDescendants() do -- You dont have to loop through the whole game, you could loop through one service at a time.
   if v:IsA("Script") or v:IsA("LocalScript") or v:IsA("ModuleScript") then
      local source = v.Source
      if v.Source:find(":SetCoreGuiEnabled") then
         print(v)
      end
   end
end
3 Likes

you defined starter gui in your variable but didn’t use it, correct script is:

local StarterGui = game: GetService(“StarterGui”)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
1 Like
local StarterGUI = game:GetService("StarterGui")
StarterGUI:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
wait(1)
print(StarterGUI:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack))

I put print(StarterGUI:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack)) there for debugging, if this doesn’t work and it prints out “True” then there should be a script keeping this on True.
If u are getting any error, do u mind sharing the error you’re getting? Thanks

–LocalScript
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)

For sure how you call it. Uses these calls a lot.