Output: Players.Player.PlayerGui.Catalog.LocalScript:15: attempt to call method 'FindFirstChild' (a nil value)
function UpdateItems()
local x, y = 0, 0.2
removeOldOutOfTheWay(gui.Main.Items:GetChildren())
local lo = gui.Parent.Parent.Character:GetChildren()
for _, child in pairs(lo) do
if child.className == "Hat" then
local new = settings.Items:Clone()
new.Position = UDim2.new(x, 0, y, 0)
new.Text = child.Name
x = x + 0.031
new.Parent = gui.Main.Items
local removed = gui.Main.Items:GetChildren()
for i = 1,#removed do
removed[i].MouseButton1Up:connect (function()
lo:FindFirstChild(removed[i].Text):remove()
end)
end
end
end
end
local a = gui.Parent.Parent.Character
a.ChildAdded:connect( UpdateItems )
a.ChildRemoved:connect( UpdateItems )
UpdateItems()

12 comments
You need to include a description of what the script is supposed to be doing.
line 15 will remove the hat from the player that is the part that is broken all other works fine
You are trying to call FindFirstChild on a table value(lo)
You can only use FindFirstChild() on objects and such.
so how should i do this ? ive never had this problem before..
https://scriptinghelpers.org/questions/17221/functions-with-tables
^ Instead of that, he could just do gui.Parent.Parent.Character:FindFirstChild() and just never call GetChildren.
still nil value
What did you change it to? Update your post?
Are the children of 'removed' a TextLabel or something?
its a textbutton
use should use the pairs.