Remote function calling module function doesn't work on its own

local event = game:GetService("ReplicatedStorage"):FindFirstChild("InventoryEvents"):FindFirstChild("BuyItem")
local admins = require(game:GetService("ServerStorage"):FindFirstChild("Admins"))
local DataManager = require(game:GetService("ServerScriptService"):FindFirstChild("Data"):FindFirstChild("DataManager"))
local ItemRegistry = require(game:GetService("ServerScriptService"):FindFirstChild("Data"):FindFirstChild("ItemRegistry"))

function BuyItem(player, itemId)	
	if player and itemId then
		return DataManager:Purchase(player, itemId)
	else
		return {true}
	end
end
event.OnServerInvoke = BuyItem

why does this code only work with the if statement (mainly filler code but it now makes sense to have it)? If it just has the DataManager:Purchase(player, itemId) line and nothing else, there is no output.

[don’t mind the variable named event, i moved from remote events to functions and was too lazy to change variable names]

Try printing player and itemId before the if statement.

Why do you have the return {true} in {}? You can just do return true.

Also make sure that player, and itemId are being sent properly.

So I can send specific output data back to the client like
{true, 'Specific error information'} or {false}