Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a way to get the number of a limited item that a player owns?

Can't seem to find anything online about this. Kind of an odd question tho so I'm not too surprised.

1 answer

Alright, So, we need a PlayerOwnsAsset, Ill just give you the finished script, You should learn about PlayerOwnsAsset tho!

local Item_ID = 98253626 -- the item i wish i had and i really want it lol
 
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, item_ID)
	if not success then
		print("Well this script does not know if "..player.Name.." Has "..item_ID)
		print(success, dosePlayerOwnAsset)
	elseif success then
		if doesPlayerOwnAsset == true then -- if he has it
		print(player.Name.." Has the item with the id of "..item_ID
		print(success, dosePlayerOwnAsset)
		elseif dosePlayerOwnAsset == false then -- if he dose not have it
		print(player.Name.." Dosen't have the item with the id of "..item_ID
		print(success, dosePlayerOwnAsset)
	end
end
end
end)

Alright, See you next time! :D also you may remove the success if you don't want it to scan if its correct or not, Just saying you should keep it, ALSO I might not have made the correct placing but you can mess with it!, Also not tested xD

1 comment

0

I figured out a way to get what I needed using the Inventory API. This only checks if the player owns a specific asset. I was trying to get the quantity of a limited item the player owns.

This discussion is preserved as it was. New answers, comments, and votes are closed.