Disable player reseting

How to disable reset button?

1 Like
1 Like

print this error
SetCore: ResetButtonCallback has not been registered by the CoreScripts

1 Like

This is a common error when it comes to attempting to use SetCore too quickly. The only fix for this is creating a function that repeatedly attempts to use SetCore until there’s no error and the value is changed.

2 Likes

and how to write the loop, because i tried to use while, but the error shuted down the script

1 Like
wait()game:GetService("StarterGui"):SetCore("ResetButtonCallback",false)

I added a LocalScript in StarterGui and it works.

7 Likes

for me it worked, but i needed to reset first

1 Like

ok i tried to make bigger delay in wait and it work

1 Like

Ok nice mate, I hope it really helped.

1 Like

you could also use
wait()game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
in a local script under ReplicatedFirst, and this wont throw any errors. Its usually a good habit to use SetCore in LocalScripts that are in ReplicatedFirst

Wait at the beginning of any script is a code smell and core features will not be registered by the time code in ReplicatedFirst executes. This is not a good habit and if you have this as a habit, you need to get rid of it. Wait should not be a go-to for time/loading-related issues.

Hi, I have tried all of the above, putting it as a local script, in ReplicatedFirst, and also StarterGUI, but i always get ’ SetCore: ResetButtonText has not been registered by the CoreScripts - Client - LocalScript:11’

If someone has this working let me know…

local script is

--wait()game:GetService("StarterGui"):SetCore("ResetButtonCallback",false)
--wait(10)
local resetBindable = Instance.new("BindableEvent")
resetBindable.Event:connect(function()
	-- Implement custom reset logic here
	print ('reset detected')
end)

-- This will remove the current behavior for when the reset button 
-- is pressed and just fire resetBindable instead.
wait()game:GetService("StarterGui"):SetCore("ResetButtonText", 'Do it')
wait()game:GetService("StarterGui"):SetCore("ResetButtonCallback", resetBindable) 

print (' in it')

what I am really trying to do, is control where they spawn using Firstspawn, if they did a manual reset.

Thanks, please msg me directly too so I can know of the reply

There is no ResetButtonText? Only ResetButtonCallback. Remove the line with ResetButtonText.

ResetButtonText doesn’t exist. Additionally, my original advice on this thread seems to have suggested not using a wait before using SetCore, so you should take this advice as well. The original idea of using a wait before SetCore, whoever proposed it, is bad advice.

I wrote some code a while ago using Promises (with help from the library author) that helps resolve this problem. You will need to install Promise to your game to use the code sample. Run the following in the command bar to help you quickly install them:

local Http = game:GetService("HttpService")
local HttpEnabled = Http.HttpEnabled

Http.HttpEnabled = true

local m = Instance.new("ModuleScript")
m.Parent = game:GetService("ReplicatedStorage")
m.Name = "Promise"
m.Source = Http:GetAsync("https://raw.githubusercontent.com/evaera/roblox-lua-promise/master/lib/init.lua")

Http.HttpEnabled = HttpEnabled

Next, install my PromiseSetCore code. You can install my code the exact same way, you will just need to change what the GetAsync points towards as well as the module’s name. Run the same thing in the command bar. You could run them together but I don’t want to overcomplicate the steps for you. This is a little unconventional since this sample puts it in ReplicatedFirst.

local Http = game:GetService("HttpService")
local HttpEnabled = Http.HttpEnabled

Http.HttpEnabled = true

local m = Instance.new("ModuleScript")
m.Parent = game:GetService("ReplicatedFirst")
m.Name = "PromiseSetCore"
m.Source = Http:GetAsync("https://raw.githubusercontent.com/colbert2677/Roblox-Code-Samples/master/Libraries/PromiseSetCore.lua")

Http.HttpEnabled = HttpEnabled

After that, put a LocalScript in ReplicatedFirst and call it whatever you’d like. In it, we are going to use PromiseSetCore to set the ResetButtonCallback. If you are doing any heavy reset logic, then I’d advise defining the reset logic elsewhere.

local PromiseSetCore = require(script.Parent.PromiseSetCore)

local ResetEvent = Instance.new("BindableEvent")
ResetEvent.Event:Connect(function ()
    warn("Reset attempted")
end)

PromiseSetCore("ResetButtonCallback", ResetEvent)

Rest is up to you to figure out, including if you want to apply better practice for this.