Disabling Game Interface

Hey, i got this script on developer roblox page for disable game interface, but its not working on my main game, i made a baseplate for testing, and it worked, can someone help me?

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

This code is located on a LocalScript inside StarterGui.

Try adding a wait above the code so it’s not immediately ran. It’s probably cause it’s taking a while for the game to load

Dont works, i made a 20 seconds wait, and dont works

There’s nothing wrong with that code, is that the only thing in the script?

Yep!, just this two lines on the script.

Do you wanna try put it in StarterPlayer or StarterCharacter?

Or you could maybe run

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