Returning a table from a localscript sending a remote

Hi,
I got a local script in player Character that fires a remote called GetInfo
(localscript)

local Interactables = game.ReplicatedStorage.GetInfo:FireServer("Floor1")
print(GameComponents.Floor1["Planks_A"][1])

then there is a script inside ServerScriptService listening to the remote
and it needs to return the table from a module inside ServerStorage
(Script)

game.ReplicatedStorage.GetInfo.OnServerEvent:Connect(function(_,ListName)
return GameComponents.Floor1
end)

and then last the module script inside ServerStorage named GameComponents contains a table with tables
(modulescript)

local module = {

– 1 2 3 4 5 6 7 8 9 10 11 12
– mechanic,distance,SFX,SFXVolume,activated,T1,T1rem,T2,T2rem,T3,T3rem,Failedstring

Floor1 = {
        		Planks_A = 			{"falling",10,516777998,0.1,false,"Crowbar",true,"",false,"",false,"Need a Crowbar..."},
        		Unlocked_Door = 	{"door",10,833871080,0.1,false,"",false,"",false,"",false,"..."},
        		Locked_Door_key1 = 	{"door",10,833871080,0.1,false,"key1",true,"",false,"",false,"Need key1..."},
        		PowerGenerator_1 = 	{"generator",5,2737790100,0.6,false,"",false,"",false,"",false,"U need a wrench to fix the Power Generator..."},
        		ElectricDoor = 		{"falling",10,2737790100,0.6,false,"...",true,"",false,"",false,"This door needs power..."},
        		Lever_A = 			{"lever",5,2737790100,0.6,false,"",false,"",true,"",false,"",false,""},
        		Lever_B = 			{"lever",5,2737790100,0.6,false,"",false,"",true,"",false,"",false,""},}     	
    }
    return module

if i try to go trough it inside my local script its keeps breaking on nil like the table doesn’t exist

Workspace.snoop47.CoreV0.4:9: invalid argument #1 to ‘pairs’ (table expected, got nil)

doesnt work in the local script only the server script seems to get the table back because if i print in the serverscript

game.ReplicatedStorage.GetInfo.OnServerEvent:Connect(function(_,ListName)
print(GameComponents.Floor1["Planks_A"][1]) seems to work
return GameComponents.Floor1
end)

origionally the table floor1 was just inside the local script but i wanna store it inside the module now
what am i doing wrong here ?

Remote events aren’t able to return any values, only RemoteFunctions can. You should try using a remote function first and see if that fixes your problem.

2 Likes

k ill try that brb with more news xD

1 Like

local script (player)
image

script ServerScriptService
image

result image

not working ?

omg ok it works i am stupid sorry forgot to remove the .Floor1 from print(Interactables[“Planks_A”][1]) now it works TY

1 Like