I’m making an order system, where the player can order from the menu, and it will pop up on a ScreenGui. For some reason I keep getting the error in the title, could anyone help?
I’m also not very good at returning, could someone also confirm I’m using returning correctly?
local OrderMenu = {}
local repStorage = game:GetService("ReplicatedStorage")
local modules = repStorage:WaitForChild("Modules")
local queueModule = require(modules:FindFirstChild("_Queue"))
local frameSample = repStorage:WaitForChild("OrderSample")
local Players = game:GetService("Players")
local function getChildrenOfClass(_uiSample, class)
local returnedClass = {}
for index, v in pairs(_uiSample:GetChildren()) do
if v:IsA(class) then
table.insert(returnedClass, v)
end
end
return returnedClass
end
OrderMenu._UpdateClients = function(player, orderItem)
local playerGui = player.PlayerGui
local orderBack = playerGui.OrderGui.Back
local orderScrollingFrame = orderBack.ScrollingFrame
local orderSample = frameSample:Clone()
local nonQueueItems = getChildrenOfClass(orderScrollingFrame, "Frame")
local _amountOfNonQueueItems = #getChildrenOfClass()
local _samplePositions = {
UDim2.new(0.029, 0,0.039, 0);
UDim2.new(0.026, 0,0.391, 0);
UDim2.new(0.027, 0,0.752, 0)
}
if _amountOfNonQueueItems < 3 then
orderSample.PlayerName.Text = player.Name
orderSample.OrderItem.Text = orderItem
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(player.UserId, thumbType, thumbSize)
orderSample.PlayerAvatar.Image = content
orderSample.Position = UDim2.new(_samplePositions[_amountOfNonQueueItems])
end
end
return OrderMenu