Hello there. I will try to keep this topic as short as possible. I was making a custom player board, but I came across an error. When I tried sending an array and a dictionary, I got an Cannot convert mixed or non-array tables: keys must be strings
error. I am guessing that the error is caused by the dictionary rather than the array, but I am not really sure. Here is the code that fires the event:
local Module = {}
-- Variables --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("RefreshPlayerListEvent")
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local TeamList = {}
local PlayerList = {}
-- Scripting --
function Module:UpdatePlayerList(Player1, Player2)
for i, v in pairs(Teams:GetChildren()) do
if v.Name ~= "Choosing" and #v:GetPlayers() > 0 then
TeamList[v:WaitForChild("LayoutOrder").Value] = v.Name
local TemporaryPlayerList = {}
for o, p in pairs(v:GetPlayers()) do
table.insert(TemporaryPlayerList, p.Name)
table.sort(TemporaryPlayerList, function(a, b) return a:lower() < b:lower() end)
end
PlayerList[v.Name] = TemporaryPlayerList
end
end
if Player1 then
Event:FireClient(Player1, TeamList, PlayerList)
if Player2 then
Event:FireClient(Player2, TeamList, PlayerList)
end
elseif not Player1 or not Player2 then
Event:FireAllClients(TeamList, PlayerList)
end
end
return Module
If you could help me with my problem, that would be awesome. If sending a dictionary is impossible, then how could I achieve the same goal using other ways. Thank you.