local event = game.ReplicatedStorage:WaitForChild("RequestUser")
local plr = game.Players.LocalPlayer
local inputbox = script.Parent.Parent.InputBox
local lastRequested
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
if inputbox.Text ~= "" then
inputbox.Parent.Visible = false
if inputbox.Text ~= lastRequested then
debounce = true
lastRequested = inputbox.Text
local stringReceived = event:InvokeServer(inputbox.Text)
if stringReceived then
script.Parent.Text = stringReceived
task.wait(1)
script.Parent.Text = "Request"
debounce = false
else
task.wait(1)
debounce = false
end
end
end
end)
This is the error line:
local stringReceived = event:InvokeServer(inputbox.Text)
That tells me thereâs a remote function youâre invoking on the server, could we have a look at the remote function youâve got set up on the server please?
local httpService = require(game.ServerStorage.HTTP)
local baseUrl1 = "https://avatar.roblox.com/v1/users/"
local baseUrl2 = "/outfits"
local requests = {}
local Players = game:GetService("Players")
local GuiPart = workspace.GuiPart
local Frame = GuiPart.SurfaceGui.Frame
local PlayerNameText = Frame.BottomFrame.PlayerName
local PlayerIconImage = Frame.MiddleFrame.PlayerIcon
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local QueuePart = workspace.QueuePart
local QueueScroll = QueuePart.SurfaceGui.Frame.ScrollingFrame
local QueueTemplate = script.Template
local CurrentRequested
local checkPlayer = function()
if #requests >= 1 then
local userId = (requests[1])
local data = httpService.getasync(baseUrl1..userId..baseUrl2)
if data then
CurrentRequested = userId
local name
pcall(function ()
name = Players:GetNameFromUserIdAsync(userId)
end)
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
PlayerNameText.Text = name
PlayerIconImage.Image = content
game.Workspace.Map.Outfits:ClearAllChildren()
local outfits = data.data
for i, v in outfits do
local desc = game.Players:GetHumanoidDescriptionFromOutfitId(v.id)
local c = game.ServerStorage.BaseAvatar:Clone()
c.Name = v.name
c.Parent = workspace.Map.Outfits
c.HumanoidRootPart.Position = Vector3.new(workspace.StartingPoint.Position.X + (5 * (#workspace.Map.Outfits:GetChildren() - 1)), workspace.StartingPoint.Position.Y + 2.5, workspace.StartingPoint.Position.Z)
c.Humanoid.NameDisplayDistance = 50
c.Humanoid:ApplyDescription(desc)
c.HitBox.Position = c.HumanoidRootPart.Position
end
table.remove(requests, table.find(requests, userId))
QueueScroll:FindFirstChild("1"):Destroy()
local Items = 0
for _, Child in ipairs(QueueScroll:GetChildren()) do
if Child:IsA("Frame") then
Items += 1
end
end
for i = 1, Items do
for _, Child in ipairs(QueueScroll:GetChildren()) do
if Child:IsA("Frame") then
Child.Name = i
end
end
end
end
end
end
local loop = function()
while task.wait(60) do
if #requests >= 1 then
checkPlayer()
else
repeat game:GetService("RunService").Heartbeat:Wait() until #requests >= 1
end
end
end
game.ReplicatedStorage.RequestUser.OnServerInvoke = function(plr, targetName)
local targetUserId = game.Players:GetUserIdFromNameAsync(targetName)
if targetUserId ~= nil then
local isOnRequests = false
for i, v in pairs(requests) do
if v == targetUserId then
isOnRequests = true
break
end
end
if isOnRequests == false then
if not table.find(requests, targetUserId) then
table.insert(requests, targetUserId)
QueueScroll:ClearAllChildren()
local LayoutClone = script.UIListLayout:Clone()
LayoutClone.Parent = QueueScroll
local DidAlready = {}
for i = 1, #requests do
print(#requests)
print(i)
if not table.find(DidAlready, requests[i]) then
table.insert(DidAlready, requests[i])
local PlayerThumbnail = Players:GetUserThumbnailAsync(requests[i], Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
local PlayerInfo = Players:GetNameFromUserIdAsync(requests[i])
local NewTemplate = QueueTemplate:Clone()
NewTemplate.Name = i
NewTemplate.LayoutOrder = i
NewTemplate.MainFrame.TextLabel.Text = PlayerInfo
NewTemplate.PlayerIcon.Image = PlayerThumbnail
NewTemplate.Visible = true
NewTemplate.Parent = QueueScroll
end
end
end
if #requests == 1 then
checkPlayer()
end
return "Queued"
else
return "Already Listed"
end
else
return "Doesn't Exist"
end
end
coroutine.wrap(loop)()
What might help is breakpointing the code within the event, and tell us which line it gets to, requests should never be nil, as {} != nil. Put the breakpoint here, get the remote function to invoke and let me know (click step over at the top) and let us know which line it gets to and what the variable values are. . The only two culprits I can think of are either of those for loops, probably because a request doesnât exist in the request queue at the time of invoking.
When it gets to that line (line 122), click on step into instead. Then step over until it breaks again. What line does it take you to now? Should have thought about that haha.
Youâre setting outfits to âdata.dataâ on line 40. Iâm not sure whether âdataâ is a member/key of âdataâ, Just above that line (âthat lineâ being like 40), can you print out data and run the code again. Put what it prints out here please.
This might be because youâve queried the API too much (if that âError fetching data:â print is still the print we put above line 40). Give it a few minutes and try again.