You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Check if player owns gamepass and badge and other type of assets -
What is the issue? Include screenshots / videos if possible!
My issue is that I have a ingame shop where you can purchase knives, and some of them require a gamepass to unlock, but even by owning the gamepass the knife still remains locked
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried everything, looking at assettypeid, I just learned that GamePassService is depreciated, since roblox does not make any updates about this. I’ve tried looking pretty much everywhere on chrome but since chrome is very bad with researches I found nothing related to my issue, chatgpt is too old for newest studio updates too.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
My first issues were about PromptPurchaseFinished and PromptPurchase, which has been “depreciated” too so when I realised that my old prefectly working script wasn’t working anymore because of this I literally spent 5 hours figuring this out. After that I saw that the GAMEPASS purchase prompt was working, but it does not unlock my knife at all anymore, while before these studio updates it was working PERFECTLY. I’ll send you the code snippets next here
--Check passes
if uid > 0 then --Don't check assets if the player is a guest!
for asset_name, asset_list in pairs(_G.CheckForGamePasses) do
for _, asset_id in pairs(asset_list) do pcall(function()
local id = tonumber(asset_id)
local a_dat = MarketplaceService:GetProductInfo(id)
local a_type = a_dat.AssetTypeId
local OK = false
if a_type == 21 then
OK = BadgeService:UserHasBadge(newPlayer.UserId , id)
elseif a_type == 34 then
OK = MarketplaceService:UserOwnsGamePassAsync(newPlayer , id)
else
OK = MarketplaceService:PlayerOwnsAsset(newPlayer , id)
end
if OK then
if _G.PLAYER_SESSIONS[nm] ~= nil then
if not _G.PLAYER_SESSIONS[nm].Owned_Passes[asset_name] then
_G.PLAYER_SESSIONS[nm].Owned_Passes[asset_name] = true
end
end
end
end)
end
end
end
--Code in each individual knife to unlock them with price, badge and gamepasses infos
local shopData = {
Texture = 'rbxassetid://881563193';
MeshSize = Vector3.new(.6, .6, .6);
ItemDescription = "lol this is sample";
ItemName = "Tix Knife";
Price = 2400;
TierName = "CUSTOM",
OwnerData = {"0Nex_ss", "https://tr.rbxcdn.com/b5d3ebcd088d415413e0a11cd9f72cfe/352/352/Avatar/Png", "Texture Creator"},
}
local importance = 999
local PackName = "TixPack"
local function CanDisplay(PlayerData, name)
if _G.CLIENT_DATA ~= nil and _G.CLIENT_DATA.PlayerSession ~= nil then
return _G.CLIENT_DATA.PlayerSession.Owned_Passes[PackName] -- Name of the pack
end
return false
end
return {shopData, importance,CanDisplay,PackName}
-- Code for the shop buy gamepass prompt :
game.MarketplaceService.PromptGamePassPurchaseFinished:connect(function(Player , Asset , Is)
if _G.CheckForGamePasses ~= nil then
if Is == true then
for Name , Ids in pairs(_G.CheckForGamePasses) do
if Ids[1] == tostring(Asset) then
_G.PLAYER_SESSIONS[Player.Name]["Owned_Passes"][Name] = true
_G.CheckForPassPlayer(Player)
end
end
end
end
end)
ev_BuyGp.OnServerEvent:connect(function(Player,GamepassName)
if _G.CheckForGamePasses ~= nil then
if _G.CheckForGamePasses[GamepassName] ~= nil then
local ID = _G.CheckForGamePasses[GamepassName][1]
if ID ~= nil then
local S ,e = pcall(function() game.MarketplaceService:PromptGamePassPurchase(Player , tonumber(ID)) end)
if not S then warn(e) end
end
end
end
end)
-- Code of where every gamepasses are set
_G.CheckForGamePasses = {
DoubleGems = {"137398179"}, --2x G7
QuadGems = {"137398362"},
--AdminPass = {"0", "0"},
EffectTrans = {"137398582"},
--VipTag = {"0"},
--RadioPass = {"0"},
--Aboo = {"0"},
--PhantomOutdated = {"0"},
--GoldenOutdated = {"0"},
--eggminlol = {"0"},
--greenlas = {"0"},
--outfather = {"0"},
greenpack = {"137405532"},
TixPack = {"137403426"},
godlys = {"137398709"},
spamgun = {"180264813"},
}
If you need more parts of the scripts I can send them to you.