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]