I need help with disabling the playerlist

I came up with this awhile ago, the reset button gets disabled but the playerlist only gets disabled in the studio, not in the actual game. Anyone got a clue why? It’s a localscript inside starterplayer scripts:

local coreCall do

	local MAX_RETRIES = 8

	local StarterGui = game:GetService('StarterGui')
	local RunService = game:GetService('RunService')

	function coreCall(method, ...)
		local result = {}
		for retries = 1, MAX_RETRIES 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)
coreCall('SetCoreGuiEnabled', Enum.CoreGuiType.PlayerList, false)

(it’s also under a client.CharacterAdded event as well)

couldn’t you just disable the playerlist directly?

local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

okay so I went to debug this so I did

local succ, err = coreCall(‘SetCoreGuiEnabled’, Enum.CoreGuiType.PlayerList, false)
if err then
warn(err)
end

so I could see what was happening and now it works in game with this added code??? Do I just accept this as a fix and move on?

SetCoreGuiEnabled and GetCoreGuiEnabled never fail, so you don’t need to wrap them.

For SetCore, I do this.

local function SetCoreAsync(Name: string, Value: any): boolean
	local MaxRetry = 8
	local Interval = 1
	
	for Retry = 1, MaxRetry do
		if pcall(StarterGui.SetCore, StarterGui, Name, Value) then
			return true
		end
		
		task.wait(Interval)
	end
	
	return false
end

SetCoreAsync("ResetButtonCallback", false)

Kind of crummy that there’s no core registration signal.

Good to know. I assumed it could fail because SetCore can…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.