Turning off Reset button not working: "Unable to cast string to token"

I’m trying to disable the reset button, but it says, “Unable to cast string to token”. The error is on line 16.

All the code:

local guiPopUpEvent = game.ReplicatedStorage.OpenIslandThingyThingThing
local guiClosedEvent = game.ReplicatedStorage.CloseIslandThingyThingThing
local islandSwitchGUI = script.Parent
local plr = islandSwitchGUI.Parent.Parent
local char = plr.Character
local cam = workspace.CurrentCamera
local islandFrame = islandSwitchGUI.IslandFrame

guiPopUpEvent.OnClientEvent:Connect(function(plr)
	if not islandSwitchGUI.Enabled then
		local closedBy = {false, false}
		local SGUI = game:GetService('StarterGui')
		
		islandSwitchGUI.Enabled = true
		SGUI:SetCoreGuiEnabled('Backpack', false)
		SGUI:SetCoreGuiEnabled('ResetButtonCallback', false) -- Not working??
		
		while not closedBy[1] or closedBy[2] do
			islandSwitchGUI.Close.CloseButton.MouseButton1Click:Connect(function()
				closedBy[1] = true
			end)
			
			if not closedBy[1] then
				islandSwitchGUI.GO.Button.MouseButton1Click:Connect(function()
					closedBy[2] = true
				end)
			end
			
			if not (closedBy[1] or closedBy[2]) then
				repeat game:GetService('RunService').Heartbeat:Wait()
					cam.CameraType = Enum.CameraType.Scriptable
				until(cam.CameraType == Enum.CameraType.Scriptable)

				cam.CFrame = workspace.PolyTerrain[islandFrame.IslandNameValue.Value].Camera.CFrame
			end
			
			wait()
		end
		
		if closedBy[1] then
			repeat game:GetService('RunService').Heartbeat:Wait()
				cam.CameraType = Enum.CameraType.Custom
			until(cam.CameraType == Enum.CameraType.Custom)

			cam.CameraSubject = char.Humanoid

			print('Testing')
		end
		
		guiClosedEvent:FireServer(closedBy)
		islandSwitchGUI.Enabled = false
		SGUI:SetCoreGuiEnabled('Backpack', true)
	end
end)

If I get rid of the line it will work.

ResetButtonCallback can only be modified with StarterGui:SetCore, not StarterGui:SetCoreGuiEnabled.

1 Like

Thank you Ben. Wow. That was really simple. God bless :smiley: