hey, I’ve been trying to make a map voting system and select 3 random maps to vote. I have a problem with sending a table from server to client through remoteevents, when I try looping a table in serverscript, it works fine. However, when I try looping a table in client script, it won’t print out anything. here’s the code:
Server (ModuleScript):
local maps = allMaps:GetChildren()
votes = {}
mapFolder = {}
repeat task.wait()
local random = math.random(#maps)
for i , v in pairs(maps) do
if random == i then
if not table.find(mapFolder, v) then
table.insert(mapFolder, v)
end
end
end
until #mapFolder == 3
for i, v in pairs(mapFolder) do print(v) end -- this prints the selected map
events:WaitForChild("UpdateMapsClient"):FireAllClients(mapFolder)
Client:
events:WaitForChild("UpdateMapsClient").OnClientEvent:Connect(function(mapFolder)
local buttons = {}
buttons = {}
for i, v in pairs(frame:GetChildren()) do
if v:IsA("ImageButton") then
table.insert(buttons, v)
end
end
for i, v in pairs(mapFolder) do -- this doesn't
print(i, v)
end
end)
help will be appreciated