How to disable the respawn button?

How do I disable respawning in my game entirely? I don’t want instant-respawn, etc.
Example: You go to the escape menu and the Reset Character button is grayed out.

4 Likes

game.StarterGui:SetCore(“ResetButtonCallback”, false)

This should do the trick.

You can furthermore integrate this into statements where you please.

Your welcome,
Sam.

9 Likes

For disabling the reset character button, you can use SetCore of StarterGui:

This script disables the reset button:

-- Local script In StarterGui or StarterPlayerScripts
game:FindService("StarterGui"):SetCore("ResetButtonCallback", false)
5 Likes

This function may need to be pcall’d as the CoreScripts need to register it.
Here’s an example:

local StarterGui = game:GetService("StarterGui")
local success

while not success do
    success = pcall(StarterGui.SetCore, StarterGui, "ResetButtonCallback", false)
    wait()
end
6 Likes

It worked without a pcall, thanks though :slightly_smiling_face:

2 Likes

I put the success value as a local variable in a function instead of an upvalue. This is so that when the function concludes, the variable is cleaned up. This is the function I’m using for one of my current project’s loading screens:

local function forceDisableResetting()
	local success = false
	
	while success == false do
		success = pcall(function ()
			return StarterGui:SetCore("ResetButtonCallback", false)
		end)
		if not success then wait() end
	end
end

The if statement that invokes the wait is so that the loop does not pointlessly yield if the call is successful, thus immediately attempting to start a new iteration. The while condition will not pass when success is false, so it’s near-instantaneous termination.

Typically, forcing it off is only necessary if done from ReplicatedFirst, though the registration of core elements is unpredictable and can’t be determined outside of a non-erroring core set.

4 Likes