Disabling Core UI not working?

wait()

pcall(function()

local starterGui = game:GetService('StarterGui')

starterGui:SetCore('ResetButtonCallback', false)

starterGui:SetCore('TopbarEnabled', false)

end)

This is in a LocalScript inside StarterPlayerScripts. When I join the game, nothing happens. No errors in Console. This is all that is in the script too.

2 Likes

copy-pasted that code in a new place and it works as expected to
on another note, you won’t see any errors coming from inside the pcall
instead, it returns whether it ran successfully or not, and if that is false, then it also returns an error message
you could try printing the pcalled function and see if it works fine
here’s the documentation for pcall: http://robloxdev.com/articles/Built-in-Functions-and-Variables/Lua#pcall

1 Like

Works fine, but as already mentioned you wouldn’t see any errors because you’re using pcall.

Make sure your localscript isn’t disabled. You can check this by opening the properties window with the localscript selected.

Image

image

If it isn’t disabled, open up a new place and move your localscript over to confirm if the issue is related to your current one.

Edit: Just realised you were specifically talking in client, please be more specific!!!

Still doesn’t work :confused: works when I play solo, but not on a real game. If I add time to the wait then it does work, but I don’t want players to just see the topbar disappear


In play solo /\

In online game /

This is because the StarterGui may take a bit to load in, try using

repeat wait until game:IsLoaded()
at the beginning of the script.
This will still give you the same issue (most likely) where the top bar kind of disappears but as of right now I am unsure about another way.

repeat wait() until game:IsLoaded()

print('1')

pcall(function()

print('2')

local starterGui = game:GetService('StarterGui')

starterGui:SetCore('ResetButtonCallback', false)

starterGui:SetCore('TopbarEnabled', false)

print('3')

end)

Still doesn’t work :confused:

Quickly had a look through previous devforum posts, found a solution by @Fractality_alt which is working fine. Can be found here.

-- Disable the topbar asap
coroutine.wrap(function()
	
    local timeout = 1
    local t = tick()

    while not pcall(game.StarterGui.SetCore, game.StarterGui, 'TopbarEnabled', false) and tick() - t < timeout do
	
        wait()

    end

end)()
1 Like

Another way I know to write that is:

pcall(game.StarterGui, 'SetCore', 'TopbarEnabled', false)

Use the way you better like.

1 Like