How do I retrieve someone's first saved outfit preset?

I am making it so when someone joins, it looks through their outfits and finds the oldest one, What should I do?

You’ll need to buy the data off something like rolimons or you’ll have to make platform that checks active roblox players automatically. Which would actually cost a lot of money as you’ll need to rent a database. Or you can forget about the ancient clothes and make a script that collects a player’s clothing every time they join.

Here you go, I just wrote this script & used your user ID to test, the function returns an array of outfit IDs in ascending order (smallest to largest).

28477310, 28912742, 31618555, 31618593, 31618683, 32434272, 32537902, 34083548, 34702822, 36576836, 42076945, 43075482, 44596224, 46855053, 46862420, 46880463, 46956966, 47696087, 47997726, 48047363, 48199364, 48211550, 48630506, 48777954, 48778011, 48841278, 49326530, 49395488, 49416694, 49706627, 50872059, 51022472, 55183536, 58664586, 59090455, 62081604, 72715508, 100667918, 115162763, 120951569, 211907265, 1328163460, 2376055902, 3275856980, 3743774691, 4166895955, 4227387093, 4238006123, 5140141323, 6248187705

local http = game:GetService("HttpService")
local getAsync = http.GetAsync
local jsonDecode = http.JSONDecode

local outfitsUrl = "https://avatar.roproxy.com/v1/users/%s/outfits?isEditable=true&page=%s"

local function getOutfitsRecursive(userId, page, outfits)
	page = page or 1
	outfits = outfits or {}

	local requestUrl = outfitsUrl:format(userId, page)
	local success, result = pcall(getAsync, http, requestUrl)
	if success then
		if result then
			local success2, result2 = pcall(jsonDecode, http, result)

			if success2 then
				if result2 then
					for _, outfitItem in ipairs(result2.data) do
						local outfitId = tonumber(outfitItem.id)
						if outfitId then
							table.insert(outfits, outfitId)
						end
					end

					page += 1
					if page == 2 then
						return getOutfitsRecursive(userId, page, outfits)
					else
						return outfits
					end
				end
			else
				warn(result2)
				task.wait(1)
				return getOutfitsRecursive(userId, page, outfits)
			end
		end
	else
		warn(result)
		task.wait(1)
		return getOutfitsRecursive(userId, page, outfits)
	end
end

local userOutfits = getOutfitsRecursive(103548428)
table.sort(userOutfits, function(left, right)
	if left < right then
		return left
	end
end)
print(table.concat(userOutfits, ", "))
1 Like