Let us hook into roblox's respawn button

My game doesn’t use the default character model. Pressing reset in core gui does nothing as a result. I want to be able to run a function whenever that button is pressed so that I can script the respawn myself.

10 Likes

I had this in my feature request here which got quite a bit of support as well:

Oh sorry. I tried searching but couldn’t find it.

I can’t believe it’s been so long and we still don’t have access to such a basic thing. I really need it because players message me every day complaining that ‘reset broke’

1 Like

This has been requested a lot:

http://devforum.roblox.com/t/hide-grey-out-reset-character-button-or-reset-signal/
http://devforum.roblox.com/t/disable-reset-button/3574

I will try to make this happen.

27 Likes

Thank you!

I actually have a very hacky way to do this. If it’s a big deal affecting gameplay, this can be a temp solution

Rename ‘Players’ and ‘Workspace’ to whatever you want. When a player should click on the reset button, it will send out an error instead of killing the player. Using LogService, check all errors and fire a custom reset whenever an error is fired from the reset button under coregui. Tested 10/10 to work, but may lower sanity levels. Use at your own risk.

3 Likes

The problem is that I want to use this but can’t set Player.Character because I use custom characters

1 Like

It’s not removing the button, it’s just breaking the code after input and firing custom code when the error pops up

Oh my god

2 Likes

Use the StarterCharacter system?

I know lol. I want to use the button to run code that resets my custom system.

(What he’s trying to say is that resetting doesn’t work without player.Character set)
@BuildIntoGames

Right? I know that, he just has to fire code to reset his system using this method. Not sure if I’m explaining badly or I’m an idiot

1 Like

I looked at the corescripts and it appears that what you suggested will no longer work even with a character:
GitHub CoreScript ResetCharacter

local PlayersService = game:GetService("Players")

local resetCharFunc = function()
		local player = PlayersService.LocalPlayer
		if player then
			local character = player.Character
			if character then
				local humanoid = character:FindFirstChild('Humanoid')
				if humanoid then
					humanoid.Health = 0
				end
			end
		end
	end

There’s no way for it to error anymore.

local PlayersService = game:GetService("Players")

local resetCharFunc = function()
		local player = PlayersService.LocalPlayer
		if player then
			local character = player.Character
			if character then
				error("kthx")
			end
		end
	end

…you’re not actually able to edit the corescripts are you? or is this from StarterPlayer?

CoreScripts cannot be edited. The source code I posted was retrieved from ROBLOX’s GitHub which I provided a link to atop the code.

1 Like

Yeah, this would be a great addition!

WELP

That sucks

For now, a temporary fix could be to let user type “/reset” I just went to test your game but it was empty and I couldn’t test out the other weapons since the reset doesn’t work (or it does, and I just dont know how to find it because it’s not written anywhere)

1 Like

Update: I have the filed the pull request for this against the CoreScripts GitHub so it is coming soon. Just need to wait until it actually ships and then enable it.

It will work like this:

local resetBindable = Instance.new("BindableEvent")
resetBindable.Event:connect(function()
    -- Implement custom reset logic here
end)

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

-- Setting ResetButtonCallback to false will grey out the reset button
-- in the menu and players won't be able to reset in your game.
game:GetService("StarterGui"):SetCore("ResetButtonCallback", false)

I hope this covers all use cases, let me know if it doesn’t.

14 Likes