Hello there!
I was trying to make a copy of the roblox catalog inside of a game, but it keeps returning nil, can someone explain what’s going wrong? Thanks!
Output:
(keeps printing this over an over as its a loop)
It also does send the data table:
Script:
local rs = game:GetService("ReplicatedStorage")
local dataReq = rs:WaitForChild("Data")
local data
local datai
while not data or not datai do
print("retrying...")
pcall(function()
data = dataReq:InvokeServer()
end)
local plrgui = script.Parent
local imagebuttons = plrgui.ScreenGui.Frame.Frame:GetChildren()
if data then
for i, v in pairs(imagebuttons) do
print(i)
print(data)
if data[i] then
if v:IsA("TextButton") then
v.Text = data.data[i].name
end
datai = data[i]
else
print("data[i] is nil")
end
end
end
end
(And here’s the serverscript that takes the invoke)
local http = game:GetService("HttpService")
local rs = game:GetService("ReplicatedStorage")
local dataReq = rs:WaitForChild("Data")
dataReq.OnServerInvoke = function()
local result = http:GetAsync('https://catalog.rprxy.xyz/v1/search/items/details?Category=11')
result = http:JSONDecode(result)
return result
end
What did I do wrong? Any help is appreciated in the replies!
Thanks for reading!