I have an issue, it’s that for some reason my client sided script reaches the return, but doesnt end up returning it.
Client Side:
RS["Get Training Players"].OnClientInvoke = function()
local TrainingPlayersTable = {}
for Number, Template in pairs(script.Parent.Main["Host Window"]["Player List"].List:GetChildren()) do
if Template.Name ~= "ListLayout" then
table.insert(TrainingPlayersTable, Number, {PlayerID = Template["Player ID"].Value, PlayerName = Template.Trainee.Text, PlayerRank = Template.Rank.Text, MinistryRank = RS.MinistryRank.Value, MainGroupRankNumber = Template["Main Group Rank Number"].Value, IsCoHost = Template.IsCoHost.Value})
end
end
print(TrainingPlayersTable)
return TrainingPlayersTable
end
It prints the table, but the next RemoteFunction after it doesnt print at all.
Server Side:
print(RS["Get Training Players"]:InvokeClient(Player))
print(RS["Get Training Music"]:InvokeClient(Player))
The print(RS["Get Training Players"]:InvokeClient(Player)) prints on the client,
but print(RS["Get Training Music"]:InvokeClient(Player)) doesn’t so,
it has to stop at the “Get Training Players” remote.
local a = {Name = "test", something = 5} -- it's an object
local b = {"test", 5} -- it's an array
You have to return something like b, becuase it’s an array and a is an object [learn more: object oriented programming]. So I suggest converting the object to a simple array and then pass it through.
So, I thought I would clarify your response. Both a and b in your example can be passed through a RemoteEvent, RemoteFunction, BindableEvent, or BindaleFunction. However, a table with keys and an array cannot be used.
{ Name = "Test", Value = 5 } ✔️
{ 1, 2, 3 } ✔️
{ 1, 2, 3, A = "A", B = "B" } ❌
You could send two tables then combine them later or send two sub tables,
You can send Instances through remotes as long as they are replicated,
The problem with Remote and Bindable Instances are they can only serialize data as much as JSONEncode can, only string keys, no mixed-tables, cyclic tables and no Metatables.
I assumed you miss understood that the OP is using Instances as a key, as you mentioned Objects, I don’t consider Dictionaries as objects but could just be me.