Help making inventory system

So I’m making an inventory system, but I ran into a small issue

local SS = game:GetService(“ServerStorage”)
local inventoryTemplate = SS:WaitForChild(“InventoryTemplate”)

local function Setupinv(player)

local inventory = player:WaitForChild("Inventory")
local pGUi = player:WaitForChild("PlayerGui")
local mainGUI = pGUi:WaitForChild("MainGUI")
local inventoryGUI = mainGUI:WaitForChild("invGUI")
print("b")
for i, item in pairs(inventory:GetChildren()) do
	print("a")
	local itemGUI = inventoryGUI.Template.Item:Clone()
	itemGUI.Name = item.Name
	itemGUI.ItemName.Text = item.Name
	itemGUI.ItemQuantity.Text = item.Value
	itemGUI.Parent = inventoryGUI.Itemlist
	if item.Value >0 then
		itemGUI.Visible = true
		itemGUI.Parent = inventoryGUI.Itemlist
	else
		itemGUI.Visible = false
		itemGUI.Parent = inventoryGUI.Itemlist
	end
end

end
game.Players.PlayerAdded:Connect(function(player)
local gamedata = inventoryTemplate:Clone()
gamedata.Name = “Inventory”
gamedata.Parent = player

end)Preformatted text

this scripts for loop never runs. Any idea why?
For reference, heres what it looksl ike


Thanks!

Actually I just never called the function :face_exhaling: thanks for help

good

by the way the leaderstats folder display cannot support more than 4 ints or values so most of the values in the leaderstats folder inside the player will not display

maybe leaderstats isnt in the player directly, but this is just a quick heads up

I made them just for test purpose, but they’re redundant now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.