StarterGui:SetCore error

Hello everyone!

I am trying to disable the player list from view, but it isn’t working. I placed a LocalScript in the StarterGui, with the following code:

local StarterGui = game:GetService("StarterGui")

StarterGui:SetCore("ResetButtonCallback", false)
StarterGui:SetCore(Enum.CoreGuiType.PlayerList, false)

This has apparently resulted in this error:
[22:48:38.209 - SetCore: PlayerList has not been registered by the CoreScripts]
Does anyone know how to fix this? Please let me know, thank you!

Fix it

You must yield before using this command. Roblox takes a while to set up setCore sometimes.
Try this, as it can also error sometimes:

local s = false --Success
local StarterGui = game:GetService("StarterGui")
repeat 
s = pcall(function()
    StarterGui:SetCore("ResetButtonCallback", false) 
    StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
end)
wait()

until s

Explanation

Since it takes time to set setcore up, it may error when you call it before then. Call it about every few frames to see if it is set up.

Also, it is setCoreGui enabled, not setcore for the playerlist.

4 Likes

I am pretty sure you’re using the wrong function

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)

This should be it.

1 Like

Thank you, this has solved my issue. :slightly_smiling_face:

Remember to pcall() when setting the reset button callback, as sometimes it takes a while to set up.

Yielding may fix it, but it can take longer on some devices and break your entire game by erroring at the start.

This is only the case with ReplicatedFirst scripts because they run earlier than some CoreScripts. LocalScripts replicated to the player after Loaded fires already have CoreScripts loaded. pcalling becomes unnecessary at this point.

1 Like

This used to not be the case. It appears they fixed it by registering setCore methods earlier. I was not aware of this being fixed, sorry.

2 Likes