Collapse Sidebar


Returns whether the inventory of given Player contains an asset, given the ID. This method can query for hats, models, sounds, etc. This function takes a small amount of time to send a request the Roblox website.

In the case that a query fails, this function will throw an error. Therefore, it is recommended to wrap calls to this function in pcall.

  • This method should not be used for game passes, since they use a separate ID system. Legacy game passes that still depend on an asset ID should use GamePassService/PlayerHasPass instead of this method.
  • This method cannot be used to check for developer products since they can be purchased multiple times but not owned themselves. Use a GlobalDataStore to save when a developer has bought a developer product instead.


Name Type Default Description

A Player object whose inventory shall be tested for the ownership of the given asset

The ID of an asset for which the given player’s inventory shall be tested


Return Type Summary

Indicates whether the given Player’s inventory contains the given asset

Code Samples

Check for Item Ownership

This code sample demonstrates how to check if a player owns a certain item. Here, we’re checking for the item Midnight Shades, a hat that costs R$ 250. As a player enters the game, their account is checked for the ownership of that item and a message is printed.

Notice how the call to PlayerOwnsAsset is wrapped in pcall - this prevents the code from throwing an error in case the player’s inventory can’t be checked for some reason. Should such an error occur, the success variable would be false.

-- The item we're checking for: https://www.roblox.com/catalog/30331986/Midnight-Shades
local ASSET_ID = 30331986
local ASSET_NAME = "Midnight Shades"

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset

Players.PlayerAdded:Connect(function (player)
	local success, doesPlayerOwnAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, ASSET_ID)
	if doesPlayerOwnAsset then
		print(player.Name .. " owns " .. ASSET_NAME)
		print(player.Name .. " doesn't own " .. ASSET_NAME)