Getting model's name from ServerStorage?
Asked by
8 years ago Edited 8 years ago
So I'm trying to make a basic map selector gui. At the moment I'm only trying to get all the maps' names in ServerStorage which are in a Folder to print. (Everything works in play-solo in-studio, but not online or in test server) I have a local script in a gui which fires a remote event in a server script located in the ServerScriptService.
This is what I have in the server script:
01 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local networking = replicatedStorage:WaitForChild( "networking" ) |
03 | local remoteFunctions = networking:WaitForChild( "remoteFunctions" ) |
04 | local remoteEvents = networking:WaitForChild( "remoteEvents" ) |
05 | local remote = remoteEvents:WaitForChild( "remote" ) |
06 | local remote 2 = remoteEvents:WaitForChild( "makeTrainerGuiVisible" ) |
07 | local remote 3 = remoteEvents:WaitForChild( "getMaps" ) |
08 | local serverStorage = game:GetService( "ServerStorage" ) |
09 | local mapFolder = serverStorage:WaitForChild( "mapFolder" ) |
11 | remote 3. OnServerEvent:connect( function (plr) |
14 | local mapTable = mapFolder:GetChildren() |
15 | for i = 1 , #mapTable do |
16 | table.insert(mapList, mapTable [ i ] ) |
20 | remote 3 :FireClient(player, mapList) |
The server script successfully prints the name of the maps, but the local script doesn't print anything. Why would that be, what can I do to fix this?
Here's what's in the local script:
1 | remote 3. OnClientEvent:connect( function (mapList) |
2 | for i, v in pairs (mapList) do |
3 | print (i.. '-' .. tostring (v)) |