#test gamepass not adding to my inv
1 messages · Page 1 of 1 (latest)
cuz its for test, it automatically resets
Try sending the script here
** You are now Level 14! **
no, just earlier the gamepasses did go into my inventory and i was not able to buy it again
I dont get why its inconsistent
local MarketplaceService=game:GetService("MarketplaceService")
local ReplicatedStorage=game:GetService("ReplicatedStorage")
local RetriveReceipts=ReplicatedStorage:WaitForChild("RetrieveReceipts")
local SetReceipts=ReplicatedStorage:WaitForChild("SetReceipt")
local RetrieveGamepassOwnership=ReplicatedStorage:WaitForChild("RetrieveGamepassOwnership")
local Players=game:GetService("Players")
local GamepassIDs=require(script.Parent:WaitForChild("GamepassIDs")).IDs
--[[
Receipt Template=
{
Player.UserId, GamepassID, Date,
}
]]
function AddReceipt(Player, GamepassID)
local Receipts=RetriveReceipts:Invoke(Player)
if(not Receipts) then
Receipts={}
end
table.insert(Receipts,{Player.UserId, GamepassID, os.date("%x")})
SetReceipts:Fire(Player, Receipts)
end
function CheckGamepass(Player, GamepassID)
local success, data=pcall(function()
--return MarketplaceService:UserOwnsGamePassAsync(Player.UserId,GamepassID)
return false
end)
if(success and data) then
return true
elseif(not success) then
error("Failed in retrieving gamepass Ownership of: "..Player.." and gamepass of ID: "..GamepassID)
end
return false
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player,id,success)
if(success and id==GamepassIDs[1]) then
print("first gamepass for 500rbx")
elseif(success and id==GamepassIDs[2]) then
print("second gamepass for 1000rbx")
end
end)
RetrieveGamepassOwnership.OnInvoke=function(Player, GamepassID)
if(not table.find(GamepassIDs,GamepassID)) then
return
else
return CheckGamepass(Player, GamepassID)
end
end
** You are now Level 2! **