Player object not being passed into Module Script

Hi!

I am currently working on migrating my current money system into an encapsulated system using a module script containing each of the functions I need. The code runs alright, however the issue comes when passing the parameters into the functions themselves.

I have drafted a simple script to test whether the system works. This is a server side script which is a child of the server script service, and runs the way I would like it to:

image

The issue comes here, when going into the function that had been called the Player parameter is nil. I know this because I added some print methods to check the names of the Player object in each function.

image

When adding the following print statements:
image
image
The result is this:

The error message seen above is caused by the script trying to access the UserId of an object which is of course not set to the instance of player.

Is there any way to ensure the player object is passed into the function?
Any help would be much appreciated,
Thanks, -ThomasMGardiner

Since these are individual functions, you should be calling them with . and not :. You defined them using . (which is correct), but you called them with : (which is not).

Calling them with : means that instead of Player being passed as the first argument, the table Functions is. This is not the behavior you want, because now Player is being passed as a second argument you’re not handling.