Hello everyone,
I’ve been making a game and need to pass a metatable I made through a BindableEvent, and then call a method of the metatable from there. The reason why I’m not doing this all in one script is because I’ll eventually have lots of different scripts I’ll need to pass them through, so I’m doing it this way to reduce hardcoding. The problem is, I can’t call the method, because it says “attempt to call missing method of table”. I’ve searched through a few topics on here but none of them have really helped me. Here is my code:
--the code in the moduleScript that actually calls the BindableEvent.
--all items in ActionQueue are BindableEvents
function player:Update()
if self.inAction then
return
end
if #self.ActionQueue == 0 then
return
end
self.inAction = true
self.ActionQueue[1]:Fire(self)
table.remove(self.ActionQueue, 1)
self.inAction = false
end
--the function that gets called
script.Parent.Come.Event:Connect(function(character)
--i've tried putting things like getmetatable, setmetatable, etc. here but nothing works
character:PathfindToPoint(script.Parent.EnterPosition.WorldPosition) --where the error occurs
end)
I’ve also noticed that any changes made in the function that gets called don’t actually replicate to the original metatable. That might be why the problem is causing, but i’m unsure
(also if anyone asks, PathfindToPoint is also a function in the script, i tested it and it worked
If anyone could help, that would be appreciated!