I have no idea wtf is happening, this code outputs an error ( https://gyazo.com/0168b4b486c548001409a959119b0233 ) saying at line 27:
itemgui.Parent = script.Parent
that script.Parent is nil.. I don't know what is means because the script does have a parent: https://gyazo.com/e82f25bb51c3c57f9998a03b86e2036a Full code:
wait(2)
local db = false
script.Parent.Changed:connect(function(val)
if db == false then
db = true
if val == "Visible" then
if script.Parent.Visible == true then
local itemstoload = game.ServerStorage.DATA_STORAGE:FindFirstChild(script.Parent.Parent.Parent.Parent.Name):FindFirstChild("Items"):GetChildren()
for i,v in pairs (script.Parent:GetChildren()) do
if v.Name ~= "Script" and v.Name ~= "EmptyItemGui" and v.Name ~= "UndoButton" then
v:Destroy()
end
end
local amountofitems = 0
for i,v in pairs (itemstoload) do
local itemgui = game.ServerStorage.EmptyItemGui:Clone()
local row = math.floor(i/3)
itemgui.Position = UDim2.new(0,((i - (row * 3)) + 10),0,((row * 130) + 10))
itemgui.Text = v.Value
itemgui.Script.Disabled = false
itemgui.Parent = script.Parent
amountofitems = i
end
script.Parent.CanvasSize = UDim2.new(0, 0, math.floor(amountofitems/6), 0)
end
end
db = false
end
end)

8 comments
Prolly because you are passing in a paramater.. and I believe frame does not have a Changed Function to use.
Nevermind, it seems Frame does have a Changed part, the problem with that loop there is using script.Parent inside the loop, which, if you know how Nodes work, eventually it will become null if itemstoload is larger than the amount of .Parents it can go to.
itemstoload was only 4 string values when I tested this..
What is the script's name?
This is rather peculiar
"LoadItems"
You're destroying the Script, and therefore it doesn't have a Parent by the line you want.
ooo ty I didn't notice that, I forgot to change in that if V.Name ~= "Script" to "LoadItems" when I changed the script's name..