I cant see why it errors cannot call non-function nil
--using the function
local player_handler = require(script.Parent.Parent.PlayerRelated.PlayerHandler)
--other stuff here
for _, player: Player in player_handler.PlayersNotInGame do
player_handler:SwitchPlayerArray(player: Player) -- cannot call non-function nil error here
--other stuff here
--defining in module
function player_handler:SwitchPlayerArray(player: Player): ()
--If the player is InGame, then move him into NotInGame
if table.find(self.PlayersInGame, player) then
return table.insert(self.PlayersNotInGame, table.remove(self.PlayersInGame, table.find(self.PlayersInGame, player)) :: Player)
end
--other stuff here
I suspect that where you require the module function it may be an incorrect reference. I think the script.parent.parent etc. may be wrong. That or like the guy above me said, maybe the syntax is wrong with the missing â()â.
I define the method using a colon instead of a period, because I need to automatically pass self (as you can see, I used self to access the other elements on the player_handler module)