Thanks to your help, I re-worked my leaderstat script entirely. I want it to count the amount of clothing items purchased, or "Bought" in my homestore.
However, It is still not working.
I used "123456" as placeholders. These would contain actual clothing IDS
Any ideas?
local marketPlaceService = game:GetService("MarketplaceService")
local playerOwnsAsset = marketPlaceService.PlayerOwnsAsset
local Players = game:GetService("Players")
local Clothes = {
123456;
1234567; }
Players.PlayerAdded:Connect(function(Plr)
local Statistics = Instance.new("Folder")
Statistics.Name = "leaderstats"
Statistics.Parent = Plr
local Bought = Instance.new("IntValue")
Bought.Name = "Bought"
Bought.Value = 0
Bought.Parent = Statistics
for _, itemID in ipairs(Clothes) do
local success, purchasedItem = pcall(playerOwnsAsset, marketPlaceService, Plr, itemID)
if purchasedItem then
Bought.Value = Bought.Value + 1
end
end
end)
