Is there a way to set the reset button to false when game is in progress instead of StarterGui?

I want to able to turn off the reset button during the game, and I can’t use starterGui because I need to be able to set it to true when game resumes, I’m creating a main menu

1 Like

I’m assuming you’ve already figured out SetCore and you’re trying to disable the built-in reset button. Even though you’re calling the SetCore function on StarterGui, it will actually update in real-time like you’d expect:

wait(untilRoundStartsOrWhatever)
game.StarterGui:SetCore("ResetButtonCallback",false) --disable the button
wait(untilRoundEndsOrWhatever)
game.StarterGui:SetCore("ResetButtonCallback",true) --enable the button
4 Likes

From my experience the failure of method above is pretty common

Ah thank you! i thought you can’t change what’s in Starter[Roblox service] after game has already ran :slight_smile:

I should clarify that the contents of StarterGui will be copied over to a player when they join the game (or when they spawn) so there’s no point in changing the contents while the game is running, but SetCore specifically will still work like you’d expect it to. It’s kinda weird but that’s how it works.

NOTE: This script is NOT created by me, it’s been posted here before but I’m using it in some of my places, it’s pretty efficient, never had any issues with it, so I’m just reposting it in case you’d use it.

local coreCalls do
	local retriesAvailable = 8
	
	local starterGui = game:GetService("StarterGui")
	local runService = game:GetService("RunService")
	
	function coreCall(method, ...)
		local result = {}
		
		for i = 1, retriesAvailable do
			result = {pcall(starterGui[method], starterGui, ...)}
			if result[1] then
				break
			end
			runService.Stepped:Wait()
		end
		return unpack(result)
	end
end

coreCall("SetCore", "ResetButtonCallback", false)
2 Likes

While we are still active on this post, is there a way I can also disable the camera mode so it can’t be changed until I tell it that it’s allowed to?

What would disabled CameraMode make it look like?

woah wait there, how did you make a var do? (will it do your code now?)

It’s possible to use SetCore before the function has been registered by the CoreScripts, but once it’s registered it’s reliable (at least, in my experience). I always try to have some sort of yield before disabling the reset button to avoid that issue. Here’s an example that’ll put it through its paces:

while wait(0.2) do --loop every 1/5 second
	game.StarterGui:SetCore("ResetButtonCallback",false) --disable it
	wait(0.2)
	game.StarterGui:SetCore("ResetButtonCallback",true) --enable it
end
1 Like

I have a script that changes camera’s cframe and if they change camera mode it returns to player, I wanted it to be set to off when I’m in the main menu and on when I’m on game

The only time this is relevant to use is around game start-up because the CoreScripts do not immediately register options for Set/GetCore. If this is mid-game, then you do not need to have any kind of wrapper or retry function for using SetCore.

Core options are typically registered shortly after the DataModel has been replicated to the client. This function IIRC was used for either scripts that ran shortly after the game loaded or for those in ReplicatedFirst trying to initialise.

1 Like