Okay, the title is a bit lackluster, so let me elaborate.
I have tried making a sample moduleScript for fun to practice OOP (Object Oriented Programming), and I wanted to create a Retriever function. Basically all objects on creation are put into a table, and that table is being searched through with that function, taking a unique ID as a parameter.
function sample.GetObjectById(id:number)
local found = nil
print(STORAGE) -- The storage table (prints out nil)
for i, object in pairs(STORAGE) do
if (object.Identifier == id) then
found = object
break
end
end
-- In this case, the object.Identifier is a property of the object
return found
end
Basically finding the same value of a property that was inputted as a parameter.
However, I found that the client isn’t aware of objects created by the server. Therefore, it sees the storage table as nil (see the print above). Am I doing something wrong or is this intended behavior? I would also appreciate possible workarounds for this, for potential future modules.
TL:DR - The function in an OOP module script, when called from the client, isn’t aware of the things happening on the server.
Any help appreciated!