Why is it not printing a table?

Why is the local script “print(v)” not printing a table?

Server Script

parties = {}

function inviteAccepted (player, playerTheyJoining)
	if parties[playerTheyJoining.Name] == nil then
		table.insert(parties, playerTheyJoining.Name)
		print(repr(parties))
		--parties[playerTheyJoining.Name] = {playerTheyJoining.Name}
		if parties[playerTheyJoining.Name] ~= nil then
			parties[playerTheyJoining.Name] = {parties[playerTheyJoining.Name], player.Name}
		else
			parties[playerTheyJoining.Name] = {player.Name,playerTheyJoining.Name}
		end
		print(repr(parties))
		updatePartyPlrGui:FireAllClients()
	end
end

function getParties()
	return parties
end

acceptRemote.OnServerEvent:Connect(inviteAccepted)
getPartiesRemote.OnServerInvoke = getParties

Local Script

function updateList()
	local partyTable = game:GetService("ReplicatedStorage").RemoteFunctions.GetParties:InvokeServer()
	local val1 = table.unpack(partyTable)
	print(val1)
	print(partyTable)
	for i, v in pairs(partyTable) do
		print(v)
		if  type(v) == "table" then
			print(v)
			if v[player.Name] then
				print('yeyeyeyeyey')
				for a, b in pairs(v) do
					local newTemp = script.Parent.Parent.InPartyTemplate:Clone()
					newTemp.Parent = script.Parent.Parent.PlrsInParty
					newTemp.Name = b
					newTemp.TextLabel.Text = b
					local playerID = game:GetService("Players"):FindFirstChild(b).UserId
					newTemp.ImageLabel.Image = game:GetService("Players"):GetUserThumbnailAsync(playerID, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
				end
			end
		end
	end
end

remote2.OnClientEvent:Connect(updateList)
1 Like

Is the acceptRemote fired before the getPartiesRemote is invoked? Is print(v) printing out what seems to be nonsense for you, or nothing at all? It’s possible you’re seeing the table’s address, or however roblox handles it internally.

This snippet

is also a bit redundant, you already know what the result of that indexing will be from the outer if statement.

1 Like

Output please? And I don’t know the problem yet, but try using ipairs(more efficient). Ill respond once you reply the output

The acceptRemote is fired before the getParties remote is invoked. print(v) is printing out a string (I think. I’m testing it with Player1 and Player2, and it just prints out Player1 or Player2, depending on which test client I invite the other.) And thanks for telling me about the redundant part!

The output for print(v) is what I said in my previous post.