im trying to make an inventory system and im trying to make it so: if a player owns a tool it will be in the backpack if its in the backpack the button with the same name will be visible
the problem: on child added doesnt work
this is what i have so far:
local script inside StarterGui.Inventory.MainFrame.Menu.ScrollingFrame
local player = game.Players.LocalPlayer local backpack = player.Backpack function togglebutton(name) local ui = script.Parent for i,v in pairs(ui:GetChildren()) do if v.Name == name then v.Visible = true end end end function dostuff() for i,v in pairs(player.Backpack:GetChildren()) do if v:IsA("Tool") then togglebutton(v.Name) end end end game.Players.PlayerAdded:Connect(dostuff) backpack.ChildAdded:Connect(dostuff)