event.OnServerEvent:Connect(function(player,id,imageid,clothesname)
local mystring = string.lower(clothesname)
local character = player.Character
print("test1")
local function processreceipt(receiptInfo)
print("test2")
local playerProductKey = receiptInfo.PlayerId..":"..receiptInfo.ProductId
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
print('not player')
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if player then
print('test3')
if string.find(mystring,"shirt") or string.find(mystring,"suit") or string.find(mystring,"hoodie") or string.find(mystring,"sweater") then
local shirt = character:WaitForChild("Shirt")
if shirt then
shirt.ShirtTemplate = ("http://www.roblox.com/asset/?id="..id)
end
elseif string.find(mystring,{"pants","jeans","sweatpants","shorts"}) then
local pants = character:WaitForChild("Pants")
if pants then
pants.PantsTemplate = ("http://www.roblox.com/asset/?id="..id)
end
end
local purchases = player:WaitForChild("leaderstats").Purchases
purchases.Value = purchases.Value + 1
print('test4')
local success,errorMessage = pcall(function()
PurchaseHistory:SetAsync(playerProductKey)
end)
print('test5')
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
MPS.ProcessReceipt = processreceipt
print('test6')
end)
so this is my script and only print test1 and test 6 fire the processreceipt doesnt fire at all when buying the product(its not a dev product idk if i should be using processreceipt for a 3rd party sale)

5 comments
ty that was dumb of me but when i do that it says attempt to index nil with PlayerId
@jovkon123 the correct term is player.UserId.
well i just checked the wiki apparently it was supposed to be without the brackets cuz it assigns the function to the variable cuz of the returns but it doesnt fire when its like that
What's in output
wdym? you are telling that the function is not firing, it's because you did not use brackets, it returns the function itself if you don't use brackets, do you want to call the function in other part of the script from the table or what??