I'm trying to see if I can build an inventory system from scratch, and I'm starting with turning the Starterpack into a table, then cloning an image for every item in that table, and putting it in a scrolling frame. The only problem is, I can't see the images under the scrolling frame in the explorer tab, and when I made it print the scrolling frame's children, it returned 'nil' in the output. But for some reason when I change the scrolling frame in the script from being defined as a variable to the correct path from the script instead, I can see the images under the scrolling frame, but the images themselves are completely invisible in game and I have absolutely no idea why. Can anyone help me with this?
local icon = script.Parent.ItemIcon local invF = script.Parent.InvFrame local invScroll = invF.InvScroll local hotbar = script.Parent.Hotbar local invTable = game.StarterPack:GetChildren() print(invScroll:FindFirstChildWhichIsA("ImageButton")) for i, v in pairs(invTable) do local InvIcon = icon:Clone() InvIcon.Parent = invScroll InvIcon.Name = "Item" InvIcon.IconLabel.Text = v.Name end
When you run the game, you can’t get the StarterPack of the game. Instead, get the Backpack of the LocalPlayer.
local icon = script.Parent.ItemIcon local invF = script.Parent.InvFrame local invScroll = invF.InvScroll local hotbar = script.Parent.Hotbar local invTable = game.Players.LocalPlayer:WaitForChild("Backpack"):GetChildren() print(invScroll:FindFirstChildWhichIsA("ImageButton")) for i, v in pairs(invTable) do local InvIcon = icon:Clone() InvIcon.Parent = invScroll InvIcon.Name = "Item" InvIcon.IconLabel.Text = v.Name end