Ad
Log in to vote
1

How do you print a table sent via a remote event?

Asked by 3 days ago

Hi there, does anyone know how I could use the table called "Names" in a print from a remote event? This is what the local script sends. Thanks :)

RemoteEvent:FireServer("ListOfNames", Names)
0
RemoteEvent.OnServerEvent:Connect(function(plr, Table) print(table.concat(Table, ', ')) end) something like that <-- RedcommanderV2 1240 — 3d

1 answer

Log in to vote
0
Answered by 3 days ago
Edited 3 days ago

you can just literate through the table from the server if that's what your looking for, like this:

--server

RemoteEvent.OnServerEvent:Connect(function(player,ListOfNames,table)
    if ListOfNames == "ListOfNames" then
    for i,v in pairs(table) do
        print(i,v) --prints the index and value of it
    end
    end
end)

, also you cant directly print a table, so you could just loop over it using a generic for loop

0
wouldn't using print(unpack(table)) work too?? the8bitdude11 153 — 3d
0
yes, its your choice. I pefer for loops EXpodo1234ALT 684 — 3d
0
you can also use table.concat LegitimatlyMe 503 — 3d
Ad

Answer this question