I have a script for creating a party system, i decided to use module scripts beacuse it would be used by all clients and they should be somehow connected each other, but turns out if i create a table inside the module script in one client, the other one can't see it. So i have it in a way that module script is only used from the server by use of remote functions, but the remote function keeps returning nil to the local script.
--Module Script
function crew:GetCrew(id)
print("amount of crews",#allcrew)
for i,v in pairs(allcrew) do
if v.id == id then
print("they're equal")
print("Crewsystem:",v.name,v.desc) --This prints correctly; "Crewsystem: test test"
return v
end
end
end
--Server Script that creates remote functions
function getcrew.OnServerInvoke(plyr,id)
local a = crews:GetCrew(id)
print("Remote Handler: "..a.name,a.desc) --This prints correctly; "Remote Handler: test test"
if a == nil then
return error("Cannot find this crew")
end
return a
end
--Local Script for creating crews and handling GUI's
local function UpdateMycrew()
mycrew = nil
mycrew = modules.getcrew:InvokeServer(tostring(plyr.CrewId.Value))
print("Updated mycrew")
print("Local Script:",mycrew.name,mycrew.desc) --This prints; "Local Script: nil nil"
return true
end
The module script runs and returns the right table, the remote function actually recieves the table and can print the stuff inside it. but it returns it 'nil' to the client. I don't see any syntax mistakes either, this makes no sense?

1 comment
um try local UpdateMycrew = function() instead of that