Ask for my simple backpack system

hello guys im currently making a backpack system or inventory system but i have problem its work properly when the tools already on starterpack but when i pick it up on game the inventory is not adding new frame

here the code

local bp = script.Parent
local holder = script.Parent:WaitForChild("Holder")

local scrolling = holder:WaitForChild("ScrollingFrame")
local items = scrolling:WaitForChild("Items")

local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local backpack = player.Backpack:GetChildren()

for i,v in pairs(backpack) do
	if v:IsA("Tool") then
		local newitem = items:Clone()
		newitem.Name = v.Name
		newitem.Parent = scrolling
		newitem.Visible = true
		newitem:WaitForChild("Pic").Image = v.TextureId
		newitem:WaitForChild("itemname").Text = v.Name

i need to reset my character to add the frame like that

some thing wrong on that??

1 Like

you just need to run this every time a tool is added to the backpack, your only running when the script resets (you die) and when the game starts


how to do what? i need while true do??

just Backpack.ChildAdded:Connect(function()




This helps detect any changes wether an objects was added or removed.

1 Like

maybe move this is scripting support

its worked but when i use the item its adding new frame cuz its added