Hey, I’m trying to spawn in a frame in player gui. The screengui itself works fine, but the frames don’t spawn at all in it’s parent. I can’t seem to find any answer.
local gui1 = Instance.new(“ScreenGui”)
local playerGui = player:WaitForChild(“PlayerGui”)
gui1.Parent = playerGui
for i, accessory in ipairs(accessories) do
local frame = Instance.new(“Frame”)
frame.Parent = gui1.Parent
frame.Size = UDim2.new(0, 100, 0, 50)
frame.Position = UDim2.new(0, 10, 0, (i - 1) * 60)
frame.BackgroundColor3 = Color3.new(1, 1, 1)
frame.BorderSizePixel = 0
frame.Parent = gui1.Parent to
frame.Parent = gui1 This will put the frames inside the ScreenGui, otherwise they are put in the PlayerGui.
still, the frames didn’t spawn
pairs instead of
ipairs! I never had good experiences with
changing ipairs to pairs didn’t really change anything
wait, does the frame not spawn at all or in the wrong place?
the frame doesn’t spawn at all
are they in the explorer when you spawn
What is accessories, is it a table, a folder, a model,?
not even in the explorer, they just don’t exist when spawning
can you look if they spawn in the players startergui
Then what exactly is accessories
This is from the script
local Accessory10 = InsertService:LoadAsset(“6101283635”):GetChildren()
Accessory10.Parent = script.Parent.Parent
they don’t spawn in the starter gui
id assume accessories is a table
starter gui or players player gui?
Try inserting the object with the provided id before runtime and get the children from that.
I think I figured the issue. Is that a local script?
Nope, it’s a regular script is it because it’s regular?
Hm. No a regular script is ok, it might have to the fact that the table might be empty before you access it. can you print accessories?