-- params : ...


frame = script.Parent.Parent
click = function()
	
	local folder = script.Parent:FindFirstChild(script.Parent.Name)
	local children = frame:GetChildren()
	for i = 1, #children do
		if children[i].ClassName == "TextButton" and children[i].Name ~= "MainMenu" then
			children[i].Visible = false
		end
	end
	children = folder:GetChildren()
	local Xoffset = 0
	local Yoffset = 70
	for i = 1, #children do
		local HH = frame.Parent.TextButton2:clone()
		HH.Parent = frame.SubButtons
		local HE = children[i]:clone()
		HE.Parent = HH
		HH.Name = HE.Name
		HH.Text = HH.Name
		HH.Size = UDim2.new(0, 100, 0, 50)
		HH.Position = UDim2.new(0, Xoffset, 0, Yoffset)
		HH.Visible = true
		Xoffset = Xoffset + 100
		if Xoffset == 200 then
			Xoffset = 0
			Yoffset = Yoffset + 50
		end
	end
end

script.Parent.MouseButton1Click:connect(click)
