Couldn't convert value to json

Hello. While trying to put a list in memory, I got this error: Couldn’t convert value to json.
Script:

local Memory = game:GetService("MemoryStoreService")
local Teleport = game:GetService("TeleportService")
local MatchMaking = Memory:GetSortedMap("MatchMaking")
local MatchRosters = Memory:GetSortedMap("MatchRosters")
local Matchmakeremote = game.ServerStorage.MatchMake
--local Server  = Teleport:GetPlayerPlaceInstanceAsyc()
--local ServerID = Server[4]
--print(ServerID)
MatchMaking:SetAsync(10000000, 0, 86400)
MatchRosters:SetAsync(10000000, {}, 86400)
local function Matchmake(Player)
	local Matches = MatchMaking:GetRangeAsync(Enum.SortDirection.Ascending, 200)	
	local search = true
	local lowestvalue = 20
	for _, entry in ipairs(Matches) do
		if search then
			if entry.value < 20 then
				print(entry.key)
				print(entry.value)
				if entry.value < lowestvalue then
					lowestvalue = entry.value
					print(lowestvalue)
				end
				if entry.value == 0 then
					search = false
					local roster = MatchRosters:GetAsync(entry.key)
					roster[#roster + 1] = Player
					MatchRosters:SetAsync(10000000, roster, 86400)
					for index, value in pairs(roster) do
						print(value.Name)
					end
				end
			end
		end
	end
end
local function start()
	
end
Matchmakeremote.Event:Connect(Matchmake)

Also tried:

local Memory = game:GetService("MemoryStoreService")
local Teleport = game:GetService("TeleportService")
local MatchMaking = Memory:GetSortedMap("MatchMaking")
local MatchRosters = Memory:GetSortedMap("MatchRosters")
local Matchmakeremote = game.ServerStorage.MatchMake
--local Server  = Teleport:GetPlayerPlaceInstanceAsyc()
--local ServerID = Server[4]
--print(ServerID)
MatchMaking:SetAsync(10000000, 0, 86400)
MatchRosters:SetAsync(10000000, {}, 86400)
local function Matchmake(Player)
	local Matches = MatchMaking:GetRangeAsync(Enum.SortDirection.Ascending, 200)	
	local search = true
	local lowestvalue = 20
	local key
	for _, entry in ipairs(Matches) do
		if search then
			if entry.value < 20 then
				print(entry.key)
				print(entry.value)
				if entry.value < lowestvalue then
					lowestvalue = entry.value
					key = entry.key
					print(lowestvalue)
				end
				if entry.value == 0 then
					search = false
					MatchRosters:UpdateAsync(entry.key, function (roster)
						roster[#roster + 1] = Player	
						return roster
					end, 86400)
					local roster = MatchRosters:GetAsync(entry.key)
					for index, value in pairs(roster.value) do
						print(value.Name)
					end
				end
			end
		end
	end
end
local function start()

end
Matchmakeremote.Event:Connect(Matchmake)

Exact error: Unable to convert value to json. - Server - MatchMaking:28

Help please. I really need it! Help plz.

Help pretty please! I really need it

Set roster[#roster + 1] to Player.UserId instead of Player.

No. Its supposed to be a table of players in a match

Wait. Player is an instance while player.Id is a unchangeable value unique to that player. Thanks!

The player instance is also unchangeable for any given player however you can only JSON encode primitive value types like numbers, strings, tables etc. A player instance and any instance for that matter cannot be encoded into a JSON format for it to be stored by the MemoryStoreService.