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

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

7 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.