Suddenly SetCore("PromptBlockPlayer", playerInstance) has not been registered by CoreScripts

So in my game i have a custom player list with options like Friending/Unfriending/Blocking/Unblocking players. After the new topbar update i noticed that the block/unblock option doesn’t work. So i looked at the output and there was an error saying

“SetCore PromptBlockPlayer has not been registered by CoreScripts”

To reproduce this, just try calling game.StarterGui:SetCore("PromptBlockPlayer"). or use the following function:

local StarterGui = game:GetService("StarterGui")

local LocalPlayer = game.Players.LocalPlayer

local function BlockPlayerAsync(playerToBlock)
	if playerToBlock and LocalPlayer ~= playerToBlock then
		local blockUserId = playerToBlock.UserId
		if blockUserId > 0 then
			local success, result
			repeat
				success, result = pcall(function()
					StarterGui:SetCore("PromptBlockPlayer", playerToBlock)
				end)
				if success then
					print("success")
					break
				else
					warn("BlockPlayerAsync() Failed Because "..result)
				end
				wait()
			until success == true
			if success then
				return true
			else
				warn("BlockPlayerAsync() Failed Because "..result)
			end
		end
	end
	return false
end

Heres Proof Of the error:
what

According to the developer hub it souldn’t error since i execute it far after the core scripts sould have register the SetCore StarterGui:SetCore

Extra Details

This error basically replicates every time i try to run the SetCore(“PromptBlockPlayer”, playerInstance) All the parameters are correct and i run this core from a local script like is inteded to. I wand to also report than this error started appearing after the new topbar update, but i don’t know if this has anything to do with the bug itself.

3 Likes

This is not a bug, the registration of some CoreScripts can be delayed:

1 Like

Yes, and don’t forget to always wrap these things up in a pcall to stop errors from propagating.

1 Like

Yes this can happend but the registration sould already have happend after 5 or 10 minutes. If you try it you will see that the function doesn’t work even after enough time.

Also don’t compare this SetCore as a delay since is not meant be run when the game starts.

1 Like

I always warp this functions in pcall. but the problem still happends.

1 Like

What? It totally does. Please read more carefully:

The first parameter to SetCore is a string that selects the functionality with which the call will interact: a CoreScript must have registered such a string already (if one hasn’t, an error is raised). It may be necessary to make multiple calls to SetCore using pcall in case the respective CoreScript has yet to load (or if it has been disabled entirely).

You’re meant to pcall and retry. Don’t assume core items will always have the same priority in terms of registration (e.g. they may be available on the first possible frame today, but that doesn’t mean they will be tomorrow, etc. Always assume that registration may be delayed for some time or registration may never happen at all)

1 Like

I Did use both a pcall and i tried repeating the function. This toping wouldn’t exist if this was the solution.

1 Like

The topic is fine – I’m telling you your statement there that I quoted is factually incorrect.

1 Like

Thanks for your report, we will fix this issue as soon as possible.

4 Likes

Same error happened to me, not to be too off topic.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.