I have scripted a system where orders generate and appear on the board, however, when I needed to put a local script in the generated slots, they could not longer be placed under the workspace. So, I put the surfaceGUI in the StarterGUI and properly set up the adornee. Now, the generated orders do not appear.
For those looking for the script in charge of generating and displaying orders, I’ve also provided the script:
-- Services --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGUI = game:GetService("StarterGui")
-- Variables --
local orderBoard = workspace:WaitForChild("OrderBoard")
local orderSystem = require(script:WaitForChild("OrderSystem"))
local orderNumber = 0
-- Order Function --
orders = {}
currentOrders = {}
local function createOrder()
local generatedBodyShape, generatedWoodType, generatedFretboard = orderSystem.generateOrder()
local bodyShape = generatedBodyShape
local woodType = generatedWoodType
local fretboard = generatedFretboard
table.insert(orders,{bodyShape,woodType,fretboard})
end
-- Display Orders --
local orderSlot = ReplicatedStorage:WaitForChild("OrderSlot")
local OrderSurfaceGui = StarterGUI:WaitForChild("OrderSurfaceGui")
local backgroundFrame = OrderSurfaceGui:WaitForChild("BackgroundFrame")
local function displayOrder()
for _, order in pairs(orders) do
local slot = orderSlot:Clone()
local bodyShape = order[1]
local woodType = order[2]
local fretboard = order[3]
slot.Parent = backgroundFrame
-- Order Information --
if tostring(bodyShape) == "LesPaulCustom" then
slot.OrderName.Text = "Les Paul Custom"
elseif tostring(bodyShape) == "LesPaul" then
slot.OrderName.Text = "Les Paul"
elseif tostring(bodyShape) == "FlyingV" then
slot.OrderName.Text = "Flying V"
else
slot.OrderName.Text = tostring(bodyShape)
end
slot.WoodType.Text = "<b>Woodtype:</b> "..tostring(woodType)
slot.Fretboard.Text = "<b>Fretboard:</b> "..tostring(fretboard)
table.remove(orders,tonumber(order))
end
end
-- Order Generator --
while true do
task.wait(math.random(1,5))
if orderNumber == 8 then
repeat task.wait(0.8) until orderNumber <= 8
print("Maximum orders reached!")
else
createOrder()
displayOrder()
orderNumber = orderNumber + 1
end
end