Current identity (2) cannot class security check (lacking permission 1)?

local coregui = game:GetService("CoreGui")
local hotbar = coregui.RobloxGui.Backpack.Hotbar

I’m trying to make a hotbar saving system for my game and since only the client can view their own hotbar in the coregui I have a local script (since I dont think I can get the hobar of a player from the server) to get the toolname on each slot in the hotbar section of the coregui. I then fire a remote event to save the hotbar

However when I call the hotbar variable I get this error.
Why is this and are there any solutions?

The problem is that you are trying to access Core Gui which is not availabe to scripts with a security identity of 2 (basically just LocalScripts, ServerScripts, and ModuleScripts). Core Gui can only be accessed by the Roblox Studio Command Line and Plugins.

1 Like

If this is the case then how else should I go about saving my hotbar. The only way to actually view a players hotbar is through the core GUI.

I think the only way is to sacrifice saving the order of the tools and just save the tools in the players backpack instead.

1 Like

I already do that but I want to save the hotbar order.
I’ve seen other games do it so its possible.

Do those games have custom inventory systems? Because even if you tracked the items as they are going in the player could still just move them around and you would not be able to detect that.

1 Like

Yes. I will probably have to make my own custom system as well just to save hotbars.

CoreGui can only be accessed by CoreScripts which are handled & executed by Roblox internally, in short you are unable to access & modify the features of any CoreGui, you can however remove CoreGui and implement other Gui in its place.

1 Like

is there any way I can recreate the backpack without needing to recreate its functionality?
I would love to recreate the backpack but I don’t want to lose its functionality.

how do you remove the coregui?

You can remove CoreGui altogether, you can disable certain aspects of core gui for the hotbar.

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

1 Like

You’ll need to create a custom Hotbar system for that like ER:LC