Customizable Reset Button Logic

If your game uses non-standard characters or there are areas you don’t want players to be able to reset you can now customize the reset button in the CoreGui menu to better suit your game.

The API is a SetCore method and is used like this:
game:GetService(“StarterGui”):SetCore(“ResetButtonCallback”, BindableEvent)

Setting ResetButtonCallback to a BindableEvent will mean that the BindableEvent is fired when the player tries to reset in the in-game menu. If you set ResetButtonCallback to false then the reset button in the menu will be grayed out, reducing the confusion for players when they can’t reset.

Here is a longer example of how you might use this in your game:

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)
232 Likes

Love theese new updates so much!

7 Likes

Will setting it to true restore the default thing?

6 Likes

If it’s a callback, shouldn’t it be using a bindablefunction?

5 Likes

I can’t believe you made this so fast and got it published!

Can’t wait to use it, tysvm!

9 Likes

<3!

7 Likes

Currently you have to restore the default functionality yourself. I can probably add this for convenience though.

@x_o

Technically yes, but I made it a BindableEvent to ensure that the code run can never interfere with the CoreScripts. It’s still called ResetButtonCallback because that is a more intuitive name for something that overrides the existing behavior.

2 Likes

Wouldn’t ResetButtonEvent be more intuitive, since it’s an event and not a callback?

To me that ResetButtonEvent suggests that the API will add a new event to fire when the player resets but not override the previous behavior. Callback suggests that there can only be one. I don’t think there is a huge difference either way though.

7 Likes

A possible alternative could be to use a BindableFunction, but execute it in a new thread using spawn.

1 Like

Yes! This is great.

1 Like

Why not just use a function?

2 Likes

Are we expected to yield before using this? Or is play solo just bugged?

1 Like

I love you @TheGamer101. You are the younger zeuxcg.

1 Like

Oh my god I didn’t think that this would be made so quickly!

Bless you @TheGamer101, you are a saint!

######~now we just need neon intensity properties~#####

Who said that?

10 Likes

Thank you for following up! =)

I am getting the following error on Android when I call SetCore(“ResetButtonCallback”, bindableEvent):

SetCore: ResetButtonCallback has not been registered by the CoreScripts

Do I need to yield before I call this method? Seems hacky.

5 Likes

We can fix this by registering the SetCore method earlier. I made a pull request to the CoreScripts GitHub.

3 Likes

Great addition - thank you.

4 Likes