Problem with MarketplaceService

Hello!
So I’ve recently been making a seat booking system, and it uses MarketplaceService:PlayerOwnsAsset(). However, I have a problem where I wanted to change a value inside of player if they own the asset (for example a t-shirt) but it doesn’t seem to work, even if player owns the asset. I’ve also made a TextLabel to check if player owns it, but the result is still the same - it shows that the player doesn’t own it.

Script
-- Locals

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local exaBS_Storage = game:GetService("ReplicatedStorage")
local exaBS_PF = script.exaBookingSystem_PF
local ecValue = exaBS_PF.economyClassValue
local bcValue = exaBS_PF.businessClassValue
local fcValue = exaBS_PF.firstClassValue

-- [ CLASS CHECK ]

local bcID = game.ReplicatedStorage.exaBoardingSystem_Storage.Settings.businessClassID
local fcID = game.ReplicatedStorage.exaBoardingSystem_Storage.Settings.firstClassID


local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset

wait(1)

-- Business Class Check

Players.PlayerAdded:Connect(function (player)
	local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, bcID.Value)
	if doesPlayerOwnAsset then
		bcValue.Value = true
	else
		bcValue.Value = false
	end
end)
Explorer

If someone can help me, I’d really appractice that.

1 Like

If you sell it with a gamepass, then try the following

local passid = --pass ID
local marketservice = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)

marketservice:UserOwnsGamePassAsync(player.UserId,passid) then
--code
end
end)

But I can’t do it with gamepasses, it needs to be a shirt.

local tshirtid = --pass ID
local marketservice = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)

marketservice:PlayerOwnsAsset(player,tshirtid) then
--code
end
end)

You can try this

That’s what I tried as well, it didn’t work too

You can try it without the pcall() (if you haven’t tried it before)

I actually found another way to do this. Thanks for your help tho!

Instead of just saying you found a solution, consider saying what worked for you, incase someone founds this post having the same exact issue.

bcID.Value

This must have been pointing to an incorrect asset ID.

local pID = 123456789

Players.PlayerAdded:Connect(function (player)
	if pcall(PlayerOwnsAsset, MarketplaceService, player, pID) then
		print("Player Owns..")
	elseif 
		print("Player Doesn't Own..")
	end
end)

And as well changed other scripts as the function works on a few scripts.

1 Like