Attempt to call a nil value

Hi, im trying to make system message when game staff join server and its not working script:

local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
local Players = game:GetService("Players")
local StaffMembers = {1109559347, 1}

local function SendSystemMessageToAllSpeakers(msg, channel)
	for _, v in pairs(ChatService:GetSpeakers()) do
		v:SendSystemMessage(msg, channel)
	end
end

local function PlayerAdded(plr)
	if table.find(StaffMembers, plr.UserId) then
		print("Work")
		local formatStr = string.format("%s joined the game", plr.Name)
		SendSystemMessageToAllSpeakers(formatStr, "All")
	end
end

for _, v in pairs(Players:GetPlayers()) do PlayerAdded(v) end --because the chat system takes a moment to load, a player may enter the game before it's fully loaded. We'll iterate over each player currently in the game
Players.PlayerAdded:Connect(PlayerAdded)

Error: ServerScriptService.Script:6: attempt to call a nil value

if you want to make everyone see a system message, make a remoteevent and use remoteevent:FireAllClients and the local script would be something like this:

local remoteevent = ---the remote event

remoteevent.OnClientEvent:Connect(function(msg)
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
		Text = msg;
		Font = Enum.Font.Cartoon; --whatever font
		Color = BrickColor.new("Baby blue"); --whatever color
		FontSize = Enum.FontSize.Size96; --whatever size
	})
end)

but i want to game sent it in System channel

well, I can’t really help you there, I’m not an expert at this type of stuff, I just sent you what would work for what I know. Sorry, but I hope you find the answer.