Everytime I try to fire an event from a script then I call that event to prompt a user to buy an item once they bought an item, it always comes up with this error "Argument 2 missing or nil".
Here are my scripts:
ServerScriptService>PurchaseModelHandler
local folder = game.ReplicatedStorage.PurchasedModels
local player = game.Players.LocalPlayer
local counterid = 1272040120
local lampid = 1272039316
folder.Counter.OnClientEvent:connect(function(player)
wait(3)
game:GetService("MarketplaceService"):PromptPurchase(counterid, player)
end)
folder.Lamp.OnClientEvent:connect(function(player)
wait(3)
game:GetService("MarketplaceService"):PromptPurchase(lampid, player)
end)
ServerScriptService>PurchaseHandler
local marketServ = game:GetService("MarketplaceService")
local folder = game.ReplicatedStorage.PurchasedModels
local modelBuy1 = 126893799 -- Counter
local modelBuy2 = 126893609 -- Lamp
marketServ.ProcessReceipt = function(receiptInfo)
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == modelBuy1 then
folder.Counter:FireClient(player)
elseif receiptInfo.ProductId == modelBuy2 then
folder.Lamp:FireClient(player)
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Here are all my events: https://gyazo.com/65d345303b49752a37bd5fa81906c3ad
I've tried: RemoveEvents, BindableFunctions, BindableEvents, RemoteFunctions, all came up either: "Argument 2 missing or nil" or an error about ":OnClientInvoke()" or ":OnServerInvoke()".
Please help!
