Reset Disabler not Working

I’ve been making a game recently. But, my Reset Disabler script isn’t working.
I’ll try not to waste your time by explaining what i want to achieve with the default #help-and-feedback:scripting-support template.

  1. What do i want to achieve? Succesfully use my Reset Disabler script.
  2. What is the issue? The reset button is still working like normal. image
  3. What solutions have you tried so far? I have searched the devforums a bit. Nothing helped, the same issue happened.

The following script is what i used. Please note that it’s inside a LocalScript object, which is in StarterGui.

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

Nothing shows up in the output when i run the game. Also, the only way that i’ve found to “fix” it is to reset which then disables the reset. I don’t want to use that “fix”, since it’s really hack-y.

Thanks in advance,
Sprite. :woot:

I’m not entirely sure if this is true, but can you try placing the script in ReplicatedFirst… i vaguely remember using SetCore requires the call to be relatively recent in the call line.

Also make sure to pcall it and some other stuff, and repeat the call if it happens across an error, seeing as SetCore might not work all the time if the Core UI you are setting has not loaded yet…

It’s been a while since I did anything messing with the core UI, so i could be off the board with this reply…

Okay, but how do i pcall it?

local Success, Error = pcall(function()
end)

something like

local suc, msg = pcall(function ()
    return game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)
end)

Then check if suc is true and possibly just print what msg is.

Ok, i’ll try it out.

Hopefully it works.

Nothing happened.
The reset button is still working and nothing was in the output.
(The script is in ReplicatedFirst)

local StarterGui = game:GetService('StarterGui')
pcall(StarterGui.SetCore, StarterGui, 'ResetButtonCallback', false)

This works aswell try this…
Also with my original statement, did you repeat the pcall in a loop until it worked/was set?

The reset button is still there and it’s still working.

No. Do i put it in a while true do loop?

do something like

local StarterGui = game:GetService('StarterGui')
local suc = pcall(StarterGui.SetCore, StarterGui, 'ResetButtonCallback', false)
while not suc do
    suc = pcall(StarterGui.SetCore, StarterGui, 'ResetButtonCallback', false)
end

Just tried that, the output said
21:18:17.944 Script timeout: exhausted allowed execution time - Client - ResetDisabler:3
21:18:17.944 Stack Begin - Studio
21:18:17.944 Script ‘ReplicatedFirst.ResetDisabler’, Line 3 - Studio - ResetDisabler:3
21:18:17.944 Stack End - Studio

Place a wait in the while loop

It worked! Thanks to both of you for helping me. :woot:

You can try using a RunService event.

local StarterGui = game:GetService('StarterGui')
local RunService = game:GetService('RunService')

local connection

connection = RunService.Heartbeat:Connect(function()
    local success = pcall(StarterGui.SetCore, StarterGui, 'ResetButtonCallback', false)

    if success then
        connection:Disconnect()
    end
end)

This is a quote from a previous answer for this question, it is more performant than just putting it in a while true loop.

Its not any way faster, its just got better security to prevent infinite loops.

Infinite loops takes up performance…

Only if it becomes an infinite loop