Unable to call function in ModuleScript

I’m attempting to call a function in a ModuleScript. Currently, I’m recieving an error that I’m attempting to call a nil value. The intended outcome is to print Hello World!.

I have tried to check the spelling several times…? I’m not sure what I’m missing here as this is an extremely basic intended output and I have worked with ModuleScripts many times before.

Module:

local DonationAssetsService = {}

function DonationAssetsService:GetDonationGamepasses(username)
	print("Hello World!")
end

function DonationAssetsService:GetDonationAssets(username, subCategoryTable)
	print("Hello World!")
end

return DonationAssetsService

Server:

local ServerScriptService = game:GetService("ServerScriptService")

local DonationAssetsService = require(ServerScriptService.DonationAssetsService)

DonationAssetsService:GetDonationGamepasses("BeastyBlake101")

Error:

- local ServerScriptService = game:GetService("ServerScriptService") local DonationAssetsService = require(ServerScriptService.DonationAssetsService) DonationAssetsService:GetDonationGamepasses("BeastyBlake101"):5: attempt to call a nil value
1 Like

Assure you are returning the table containing the functions within the module.

1 Like

Appears to have been a studio bug, after he restarted studio it seems to have been fixed.

1 Like

Restarted studio and there is no longer an error. Seems like some sort of studio bug potentially. Have you tried turning it on and off again?

2 Likes