Disabling resetting inconsistent

game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)

i have this simple line in a local script inside of startergui
sometimes it works, sometimes it gives me the error “SetCore: ResetButtonCallback has not been registered by the CoreScripts”
how do i make this consistent?

local success = false

while not success do
	success = pcall(function()
		game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
	end)
	if success then
		break
	else
		print'coregui being slow for ResetButtonCallback'
	end
	wait(.2)
end


2 Likes

could shorten your example. The inconsistency is just part of roblox. it must be done in a loop especially at the start.

local starterGui = game:GetService("StarterGui")
while not pcall(starterGui.SetCore, starterGui, "ResetButtonCallback", false) do
    task.wait()
end

-- code after this block will have reset button disabled.