#test gamepass not adding to my inv

1 messages · Page 1 of 1 (latest)

worn ermine
flat swan
spare yacht
#

Try sending the script here

hard sailBOT
#

studio** You are now Level 14! **studio

worn ermine
#

I dont get why its inconsistent

worn ermine
# spare yacht Try sending the script here
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
hard sailBOT
#

studio** You are now Level 2! **studio

spare yacht
#

Could be your internet, try waiting for when the player loads in before running anything else

#

local Players = game:GetService("Players") game.Players.PlayerAdded