PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

PlayerOwnsAsset

Returns whether the given player has the given asset.

Parameters

Name Type Default Description

Returns

Return Type Summary

Code Samples


MarketplaceService:PlayerOwnsAsset

This is a basic if statement telling you if the user owns the item.

In this example, when a player joins the code checks if the player owns the “Midnight Shades” item. If a player named “Player1” joins the server and owns the item, the example will print "Player1 owns the Midnight Sides. If Player1 does not own the item, the example will print “Player1 doesn’t own the Midnight Shades.”

game.Players.PlayerAdded:Connect(function(plr)
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,30331986) then
		print(plr.Name .. " owns the Midnight Shades")
	else
		print(plr.Name .. " doesn't own the Midnight Shades")
	end
end)