for K,L in pairs(script.Parent.ShopFrame.Boxes:GetChildren())do if L:IsA("\084\101\120\116\066\117\116\116\111\110")then L.MouseButton1Click:Connect(function()for K,L in pairs(script.Parent.ShopFrame.BoxContaining.Frame:GetChildren())do if L:IsA("\073\109\097\103\101\076\097\098\101\108")then L:Destroy()end end local K=game.ReplicatedStorage.Weapons:FindFirstChild(L.Parent.Weapon.Value)print(K.Name)print(L.Name)local M=K:FindFirstChild(L.Name)local J=M:GetChildren()if#J>0 then for K,L in pairs(J)do local M=Instance.new("\073\109\097\103\101\076\097\098\101\108")M.Parent=script.Parent.ShopFrame.BoxContaining.Frame M.Image=L.TextureId end end script.Parent.ShopFrame.BoxContaining.TextLabel.Text=M.Name.." \098\111\120 \099\111\110\116\097\105\110\115\058"script.Parent.ShopFrame.BoxContaining.Box.Value=M script.Parent.ShopFrame.BoxContaining.Visible=true script.Parent.ShopFrame.Boxes.Visible=false end)end end
---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
