Basically, I’m making an inventory and I need a table to go from server to client. However, the table isn’t sending properly.
Server script:
game.ReplicatedStorage.Request.OnServerEvent:Connect(function(plr)
print("Transfering data")
local transfer = {}
for i, v in ipairs(game.ServerStorage.Inventories[plr.Name]:GetChildren()) do
table.insert(transfer, v)
end
game.ReplicatedStorage.Request:FireClient(plr, transfer)
print("Fired. Here's the table: ")
for i, v in ipairs(transfer) do
print(v)
end
end)
Client script:
game.ReplicatedStorage.Request.OnClientEvent:Connect(function(inv)
print("Received inv.")
for i, v in ipairs(inv) do
print(v)
local Frame = Instance.new("Frame")
Frame.BorderSizePixel = 0
Frame.Parent = script.Parent
-- local Decal = game.ReplicatedStorage.Decals[v]:Clone()
-- Decal.Size = UDim2.new(1,0,0.8,0)
-- Decal.Parent = Frame
local Button = Instance.new("TextButton")
Button.Size = UDim2.new(1,0,0.2,0)
Button.Position = UDim2.new(1,0,0.8,0)
Button.BackgroundColor3 = Color3.fromRGB(0,170,0)
Button.Text = "Equip " .. v
Button.TextColor3 = Color3.new(1,1,1)
Button.TextScaled = true
local EquipScript = game.ReplicatedStorage.EquipScript:Clone()
EquipScript.Parent = Button
end
end)
The table has the required items when printing on the server, however when it gets to the client, the table is empty. Is there a reason for this?