Issue with Metatables

Hey! So I’m making a DataService for my game and I came across an issue!

The thing is that no matter what I do metatables simply dont work.

For more context here are some screenshots:


image

You’re inserting the metamethod’s into PlayerStore._proxy, not the metatable; setmetatable() returns the table passed in argument one and not the metatable. Do this instead.

local MetaTable = {}
local PlayerProxy = setmetatable(PlayerStore._proxy, MetaTable);

MetaTable.__index = function(self, key)

end;

MetaTable.__newindex = function(self, key, value)

end;
1 Like

Right! Thats my mistake here.

Even tho, I was doing that before I have no idea what was causing the methods not to fire.

Worked!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.