1local httpService = game:GetService("HttpService") 2local marketPlaceService = game:GetService("MarketplaceService") 3 4local repStorage = game:GetService("ReplicatedStorage") 5 6local gamePassIDTable = { 7 7851296 8} 9while true do 10 11 local gamepassIds = httpService:GetAsync("https://pastebin.com/raw/0uYVbaUn") 12 gamepassIds = httpService:JSONEncode(gamepassIds) 13 14 repStorage.GamePasses:ClearAllChildren() 15 16 for _, id in pairs(gamepassIds) do 17 18 local info = marketPlaceService:GetProductInfo(id,Enum.InfoType.GamePasses) 19 20 local newFolder = Instance.new("Folder") 21 newFolder.Name = id 22 newFolder.Parent = repStorage.Gamepasses 23 24 end 25 26 wait(5) 27 28end
COMMUNITY QUESTION
bad argument #1 to 'pairs' (table expected, got string) error on line 16?
1 answer
Even though this question is awfully presented I will still answer your question.
Your problem seems to be that you are using HttpService:JSONEncode which converts variable data into a string format. Since HttpService:GetAsync returns encoded data you will want to decode that data using HttpService:JSONDecode.
That means on line 12 you should change HttpService:JSONEncode to HttpService:JSONDecode
Hope this helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
did you even try
lol
You just pasted your error and didn't even use Lua format for this question.
No one is going to answer a vague question
with no context