---Box thing

for _,v in pairs(script.Parent.ShopFrame.Boxes:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()			
			---Clean
			for _,y in pairs(script.Parent.ShopFrame.BoxContaining.Frame:GetChildren()) do
				if y:IsA("ImageLabel") then
					y:Destroy()
				end
			end
			
			--Add
			local Weaponfolder = game.ReplicatedStorage.Weapons:FindFirstChild(v.Parent.Weapon.Value)
			print(Weaponfolder.Name)
			print(v.Name)
			local Boxfolder = Weaponfolder:FindFirstChild(v.Name)
			local Weapons = Boxfolder:GetChildren()
			if #Weapons > 0 then
				for _,y in pairs(Weapons) do
					local ImgFrame = Instance.new("ImageLabel")
					ImgFrame.Parent = script.Parent.ShopFrame.BoxContaining.Frame
					ImgFrame.Image = y.TextureId
				end
			end
			script.Parent.ShopFrame.BoxContaining.TextLabel.Text = (Boxfolder.Name).." box contains:"
			script.Parent.ShopFrame.BoxContaining.Box.Value = Boxfolder
			script.Parent.ShopFrame.BoxContaining.Visible = true
			script.Parent.ShopFrame.Boxes.Visible = false
		end)
	end
end
