How to see if the reset button has been disabled?

I was looking how to disable the reset button without it not working half the time. I found out that a repeat loop should be fine, but I have no way to check if the loop should stop (once it has been disabled.) I tried using GetCore() although that didn’t work. I basically want it to self-destruct the script after disabling the reset button since it isn’t needed.

local function disable()
	game.StarterGui:SetCore("ResetButtonCallback",false)
end

repeat disable() until (game.StarterGui:GetCore("ResetButtonCallback") == false)

wait(.1)

script:Destroy()
2 Likes

GetCore for some reason doesn’t have a return for ResetButtonCallback, so you’d have to find other ways to make it so that it is certainly disabled, maybe do it when the game is loaded via the game.Loaded event or when the Player’s Character is fully loaded to name a few

3 Likes

Would something like this work?

local function disable()
	game.StarterGui:SetCore("ResetButtonCallback",false)
end

repeat disable() until game:IsLoaded() and game.Players.LocalPlayer.Character

wait(.1)

script:Destroy()
1 Like

That could work, since it’s waiting for both the game to be fully loaded and for the character to exist

1 Like

Just tested it, it does disable it. Hopefully this works everytime, thank you! :grinning_face_with_smiling_eyes:

2 Likes

I know you already have a solution but I use a pcall to check to see if it successfully disabled it, like this:

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

It hopefully should do that, since those 2 ways are most definitely good ways of making sure the client is fully loaded in by the time Resetting should be disabled as to reduce the chances to slim levels.

I would recommend testing it a few times to ensure it disables it all the time

I think all add this in too, 3 checks should be enough :sweat_smile:

1 Like