ResetButtonCallback has not been registered by the CoreScripts

I was able to come up with a good core system that has worked for me very well. While wait is often frowned upon, it works really well here, and it doesn’t cause any notable lag for the short amount of time this code is active. When calling this function locally, make sure that you put it in a coroutine.wrap() so whatever else runs after it isn’t halted for the short period of time it takes for this to complete (unless that’s what you want.) It completely stops and frees up your memory when it’s done, thanks to Lua’s Automatic Garbage Collection:

[‘LoadRobloxCore’] = function(CoreType, CoreProperty, Toggle)
repeat
    local success = pcall(function()
        if CoreType == "SetCore" then
            game.StarterGui:SetCore(CoreProperty, Toggle)
        elseif CoreType == "SetCoreGui" then
            game.StarterGui:SetCoreGuiEnabled(CoreProperty, Toggle)
        end
    end)
    wait(0.02)
until
    success
end;

Hope this utility function helps you as much as it’s done for me!

11 Likes

I feel like reading this thread is a rite of passage at this point.

6 Likes

Going to mark a solution and lock this topic.

This is not a bug, core callbacks are not guaranteed to be registered on first few frames, or ever for that matter. You will have to handle this gracefully and retry. You will have to gracefully handle the case of components never being initialized at all.

If you are reading this and this is problematic for you, file/support a feature request (instead of bug report) to have some event to wait for core callbacks to be initialized, or that these are always initialized before developer code has a chance to touch them.

4 Likes