So here, I’ve made a module that loops trough EVERY asset in Roblox (It works)
But the thing is, the Count number is pretty really slow, and I need it to be instant…
How can I make it instant? Is there even a way to get someone’s gamepasses?
Module.GetUserGamepasses = function(Player: Player)
task.spawn(function()
if not Player then return end
local UserID = Player.UserId
local Gamepasses = {}
for Count = 1, 1000000000, 1 do
print(Count)
local Success = pcall(function()
return(MPS:GetProductInfo(Count))
end)
if Success then
local ProductInfo = Success
local Creator = ProductInfo.Creator
if Creator.CreatorTargetId == UserID then
print(ProductInfo.Name)
end
end
end
print()
end)
end
local MPS = game:GetService("MarketplaceService")
local RUN = game:GetService("RunService")
local thread = function(Count, UserID)
task.spawn(function()
print(Count)
local Success = pcall(function()
return(MPS:GetProductInfo(Count))
end)
if Success then
local ProductInfo = Success
local Creator = ProductInfo.Creator
if Creator.CreatorTargetId == UserID then
print(ProductInfo.Name)
end
end
end)
end
Module.GetUserGamepasses = function(Player: Player)
if not Player then return end
local UserID = Player.UserId
local Gamepasses = {}
for Count = 1, 1000000000, 1 do
thread(Count, UserID)
RUN.Heartbeat:Wait()
end
end
I have created a thread function that will be called and run in the background while the loop runs.
It’s much faster than before, but unfortunately still not instant. I don’t think it’s possible to make it instant, unless there is a way to get a user’s gamepasses, not everyone’s gamepasses
if you want to just get 1 person’s gamepasses you could use either a proxy, or the Inventory Api and check at all the gamepasses they own, and if the owner of the gamepass they own matches up with them, then they own that gamepass. (this will only work for people with open inventories)
Looping through every gamepass on roblox is… pretty ineffecient. You’re better off using some kind of web service to simply look at the user’s gamepasses from their inventory.