Disabling reset doesn't work all the time

I am trying to have a script that disables the default roblox reset function. The game is designed to allow for resets but it is something I want to prevent. I have looked at several threads and the solution I implemented appears to be the best one. The following is the code that I am using as a local script in StarterPlayerScripts.

The code works and the reset button gets disabled… Except there’s a problem. After a while certain players can press the Reset button again. They start the game with the button disabled but then it is enabled again. This issue is intermittent and it appears to happen at random. Has anyone experienced something like this? I’d like to add that no player deaths happen in between the button being disabled and randomly enabled again.

1 Like

if u want u can use RunService to repeat this event

1 Like

I’m not too familiar with RunService but as a quick glance doesn’t this seem a bit excessive? Will it try to disable the reset button every frame?

I believe what you could do is simpler. Place a localscript wherever you want (workspace, StarterPlayerScripts, anywhere you can place a localscript) and place this code in it

local StarterGui = game:GetService('StarterGui')

wait(0.5)

StarterGui:SetCore("ResetButtonCallback",false)

If this is disabling it and it’s getting re-enabled, it has to be because of another script re-enabling it. Do CTRL+SHIFT+F and look for ResetButtonCallback

I mean that’s essentially what I am doing except with retry logic incase it fails initially. It gets disabled just fine… Just out of no where it re-enables it again. I already tried looking this is the only instance of ResetButtonCallback in my code. Another note: When I try it the reset button stays disabled forever. When my friend tries it, it breaks after like 5 minutes.

Hmm, that’s quite odd, where the script located?

StarterPlayer.StarterPlayerScripts

that doesnt work
why?
idk why roblox doesnt find it

Try moving the script to somewhere else like StarterGui or workspace and try again. If that does work, try commenting out the code you’re using and trying out what I sent to see if it would work too

local coreCall do
	local MAX_RETRIES = 8

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

	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES do
			result = {pcall(StarterGui[method], StarterGui, ...)}
			if result[1] then
				break
			end
			RunService.Stepped:Wait()
		end
		return unpack(result)
	end
end
game:GetService("RunService").RenderStepped:Connect(function())
       coreCall('SetCore', 'ResetButtonCallback', false)
end)

I’ll try it out and get back to you when I can get some of my mates together to help me test. Thanks. Ill also try moving the location of the script into StarterGui as someone has suggested.

That code will run every frame so it’s a bit unoptimal. What I recommend is editting that code so you can disconnect the event when the button is disabled, disconnect the event.

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

local coreCall do
	local MAX_RETRIES = 8

	local RunService = game:GetService('RunService')

	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES do
			result = {pcall(StarterGui[method], StarterGui, ...)}
			if result[1] then
				break
			end
			RunService.Stepped:Wait()
		end
		return unpack(result)
	end
end
connection = game:GetService("RunService").RenderStepped:Connect(function())
	if StarterGui:GetCoreGuiEnabled('ResetButtonCallback') then
		coreCall('SetCore', 'ResetButtonCallback', false)
    else
		connection:Disconnect()
	end
end)

Again if this causes issues when you do test it out, you can revert to how it was and just disable it every frame

The reason why it doesn’t work all the time is because the roblox core scripts have not fully identified the gui or something like that. It is easily fixed 100% of the time by doing:

-- put whatever code u want up here.
wait(3)
game.StarterGui:SetCore("ResetButtonCallback",false)

This always gives it time to load + players usually aren’t passed the loading screen by the time it gets disabled.

repeat
    local success, failure = pcall(function()
        game.StarterGui:SetCore("ResetButtonCallback", false)
    end)
    wait()
until success
2 Likes