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)
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)
local tshirtid = --pass ID
local marketservice = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
marketservice:PlayerOwnsAsset(player,tshirtid) then
--code
end
end)
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.