So I have been making a trail shop and inventory. You buy the trail from the shop and you can equip it in the inventory. When you purchase a trail, it duplicates the template item frame into the inventory scrolling frame. The problem is, the template item frame is not visible at all despite having its visibility set to true. This picture shows what is supposed to look like:
To make this image, I just put the item template into the scrolling window and it is visible which means there is something else going on. Here is what it actually looks like:
And here are the properties for the item frame template when it is IN the scrolling frame:
Since there are no properties contradicting the frames visibility, it has to be nonvisible because of the inventory script. Here is the inventory script:
local shopFrame = game.StarterGui.Shop:WaitForChild("Frame")
local itemScroller = script.Parent
local itemPreview = script.Parent.Parent.ItemPreview
local trailsFolder = game.ReplicatedStorage:WaitForChild("Trails")
local ownedTrailsFolder = game.Players.LocalPlayer:WaitForChild("OwnedTrails")
local shopFrame = script.Parent.Parent
local invFrame = game.StarterGui:WaitForChild("Inventory")
local player = game:GetService("Players").LocalPlayer
shopFrame.Visible = false
itemPreview.Visible = false
local itemsFolder = game.ReplicatedStorage:WaitForChild("Trails")
function updateInventory()
for i, child in pairs(invFrame.ScrollingFrame:GetChildren()) do
if child:IsA("Frame") then child:Destroy() end
end
local ownedTrails = ownedTrailsFolder:GetChildren()
print(ownedTrails)
table.sort(ownedTrails, function(a, b)
return trailsFolder[a.Name].Price.Value < trailsFolder[b.Name].Price.Value or trailsFolder[a.Name].Price.Value == trailsFolder[b.Name].Price.Value and a.Name < b.Name
end)
for i, trail in pairs(ownedTrails) do
local item = script.Item:Clone()
item.SelectButton.Text = "EQUIP"
item.Title.Text = trail.Name
item.Parent = invFrame.ScrollingFrame
item.SelectButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.TrailSelectedRE:FireServer(false, trail)
for i, itemButton in pairs(item.Parent:GetChildren()) do
if itemButton:IsA("ImageLabel") then
itemButton.SelectButton.Text = "EQUIP"
item.SelectButton.Text = "EQUIPPED"
end
end
end)
end
end
updateShop()
updateInventory()
ownedTrailsFolder.ChildAdded:Connect(function()
updateInventory()
end)
ownedTrailsFolder.ChildRemoved:Connect(function()
updateInventory()
end)
What is wrong with my script that is causing the duplicated item frame to not be visible?
Note: It also has nothing to do with the backgound of the frame being in front of the item template. I double checked it by making the parent the ScreenGUI (invFrame) and this is what it looked like: