Scripting problem

It is a localscript, parented to a frame It is supposed to load all your items in the frame, but it only loads one item.

Player = game:GetService('Players').LocalPlayer

ParentFrame = script.Parent.Frame
ScrollingFrame = ParentFrame.ScrollingFrame

Templates = ParentFrame.Templates

Remotes = game:GetService('ReplicatedStorage').RemoteEvents

function RemoveList()
	for i, v in pairs(ScrollingFrame:GetChildren()) do
		if v.ClassName ~= 'UIGridLayout' then
			v:Destroy()
		end
	end
end

function LoadEquippedItems(Item)
	if Item == nil then return end
	RemoveList()
	ParentFrame.HelpText.Visible = false
	task.wait()
	local TempClone = Templates.Unequip:Clone()
	TempClone.Item.Text = Item.Name
	TempClone.Parent = ScrollingFrame
	TempClone.Visible = true
end

function LoadUnequippedItems(Item)
	if Item == nil then return end
	RemoveList()
	ParentFrame.HelpText.Visible = false
	task.wait()
	local TempClone = Templates.Equip:Clone()
	TempClone.Item.Text = Item.Name
	TempClone.Parent = ScrollingFrame
	TempClone.Visible = true
end

function RefreshEquippedItems()
	for i, v in pairs(Player.StarterGear:GetChildren()) do
		LoadEquippedItems(v)
	end
end

function RefreshUnequippedItems()
	for i, v in pairs(Player.StoredItems:GetChildren()) do
		LoadUnequippedItems(v)
	end
end

ParentFrame.EItemsTab.MouseButton1Click:Connect(RefreshEquippedItems)
ParentFrame.UItemsTab.MouseButton1Click:Connect(RefreshUnequippedItems)

cuz u destroy everything after parenting a template this a no brainer fr

Yeah. but there is task.wait() after it

I forgot there is a loop to do the loadItems function

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