ResetButtonCallback has not been registered by the CoreScripts

I’m trying to disable the reset button in my game, but it says ResetButtonCallback has not been registered by the core scripts. I used some code from a video, but it doesn’t work

local StarterGui = game:GetService('StarterGui')

StarterGui:SetCore ("ResetButtonCallback",false) 

This happens when you use SetCore before a CoreScript registers the core type: error is pretty literal. You can solve this by retrying the call after a bit. CoreCall is one way to sidestep this problem. Another one is by using Promises - I learned how to a bit ago with some help from the library’s maintainer.

I wrote a module for using SetCore safely. It will also require installation of the Promise library and a change to the code so that the require statement requires the Promise module, because requiring by name will not work. To use it, you require this and then pass the core type and value.

local PromiseSetCore = require("PromiseSetCore")
PromiseSetCore("ResetButtonCallback", false)

How do I implement the Promise library?

https://github.com/evaera/roblox-lua-promise/blob/master/lib/Installation.md

After it’s installed, change the require statements accordingly. Same goes with the module above, except I do not include installation instructions. Just go to the raw code view, then copy and paste it all into a ModuleScript and require that in your script for use instead of using SetCore directly.

--- Wrap SetCore attempts in a retrying Promise
-- @module PromiseSetCore
-- @author colbert2677

local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Promise = require(workspace.Utilities.Promise)

local MAX_RETRIES = 10

--- Make Promise to use SetCore in
-- @see promiseRetry
local function setCore(coreType, value)
	return Promise.new(function (resolve)
		StarterGui:SetCore(coreType, value)

		resolve()
	end):catch(function (e)
		return Promise.delay(1):andThen(function ()
			return Promise.reject(e)
		end)
	end)
end

--- Retry the Promise from SetCore
-- @param coreType Core type to call SetCore on
-- @param value Expected future value of core item
-- @return Promise The retried Promise
local function PromiseSetCore(coreType, value)
	return Promise.retry(setCore, MAX_RETRIES, coreType, value):catch(function ()
		warn("PromiseSetCore could not be resolved")
	end)
end

return PromiseSetCore

This is what I tried, no errors in output but the reset doesnt get disabled

Not enough information. That’s just the code that’s meant for a ModuleScript and I’ve explained how it’s used throughout my post as well. It’s not just something you copy and paste and then all is well. You’ll need to supply far more information than this such as hierarchy and script types.

Also, why are you putting modules in the workspace?

Where should I put the module?

Please figure out that much on your own. Do some testing and some research if you need help on understanding some things, such as best practices for code.

1 Like