so I need to detect if player has a t-shirt in there inventory, any help? I need like: if player has (the t shirt) then (I'll add code here) else (I'll add more code here)
Use this for the client
local mps= game:GetService("MarketplaceService") local id = 0123456789 -- t shirt id here local lplr = game.LocalPlayer local check = mps:PlayerOwnsAsset(lplr,id) if check == true then print(lplr.Name.." owns asset : "..mps:GetProductInfoAsync(id))-- change this to what you want if they own it else print(lplr.Name.." does not own asset : "..mps:GetProductInfoAsync(id).." prompting purchase." mps:PromptPurchase(lplr,id) end
And this for the server
local mps= game:GetService("MarketplaceService") local id = 0123456789 -- t shirt id here game.Players.PlayerAdded:Connect(function(plr) -- fires when new player joins local check = mps:PlayerOwnsAsset(plr,id) if check == true then print(plr.Name.." owns asset : "..mps:GetProductInfoAsync(id))-- change this to what you want if they own it else print(plr.Name.." does not own asset : "..mps:GetProductInfoAsync(id).." prompting purchase." mps:PromptPurchase(plr,id) end