How to make a ui button for every item in backpack?
Asked by
3 years ago Edited 3 years ago
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
01 | local player = game.Players.LocalPlayer |
02 | local backpack = player.Backpack |
04 | function togglebutton(name) |
05 | local ui = script.Parent |
06 | for i,v in pairs (ui:GetChildren()) do |
07 | if v.Name = = name then |
14 | for i,v in pairs (player.Backpack:GetChildren()) do |
21 | game.Players.PlayerAdded:Connect(dostuff) |
22 | backpack.ChildAdded:Connect(dostuff) |