Bloxthard
(Bloxthard)
October 31, 2023, 12:27pm
#1
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.
Script:
local gui1 = Instance.new(“ScreenGui”)
game.Players.PlayerAdded:Connect(function(player)
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
end
end)
4 Likes
Try changing frame.Parent = gui1.Parent
to frame.Parent = gui1
This will put the frames inside the ScreenGui, otherwise they are put in the PlayerGui.
2 Likes
Bloxthard
(Bloxthard)
October 31, 2023, 12:39pm
#3
still, the frames didn’t spawn
1 Like
Try using pairs
instead of ipairs
! I never had good experiences with ipairs
.
2 Likes
Bloxthard
(Bloxthard)
October 31, 2023, 12:47pm
#5
changing ipairs to pairs didn’t really change anything
kyan_lk
(Kyan)
October 31, 2023, 12:52pm
#7
wait, does the frame not spawn at all or in the wrong place?
1 Like
Bloxthard
(Bloxthard)
October 31, 2023, 12:53pm
#8
the frame doesn’t spawn at all
are they in the explorer when you spawn
1 Like
atfdaj
(Quoniam)
October 31, 2023, 12:54pm
#10
What is accessories, is it a table, a folder, a model,?
1 Like
Bloxthard
(Bloxthard)
October 31, 2023, 12:55pm
#11
not even in the explorer, they just don’t exist when spawning
2 Likes
kyan_lk
(Kyan)
October 31, 2023, 12:55pm
#12
can you look if they spawn in the players startergui
2 Likes
Then what exactly is accessories
2 Likes
Bloxthard
(Bloxthard)
October 31, 2023, 12:57pm
#14
This is from the script
local Accessory10 = InsertService:LoadAsset(“6101283635”):GetChildren()[1]
Accessory10.Parent = script.Parent.Parent
table.insert(accessories, Accessory10)
Bloxthard
(Bloxthard)
October 31, 2023, 12:57pm
#15
they don’t spawn in the starter gui
id assume accessories is a table
1 Like
sinanxd2
(Fisher)
October 31, 2023, 12:58pm
#17
starter gui or players player gui?
atfdaj
(Quoniam)
October 31, 2023, 12:59pm
#18
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?
Bloxthard
(Bloxthard)
October 31, 2023, 1:01pm
#20
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?
1 Like