-- скрипт по выравниванию кнопок


me = script.Parent	-- форма кнопок
wnd = me.Parent		-- главное окно
ui=me.Frame.UI
sample=script.Sample:Clone()

local tmp = me:GetChildren()
local button=0	-- количество кнопок
for i,img in pairs(tmp) do
	str=string.sub(img.Name,1,3)
	if str =="img" then
		button=button+1
	end
end

sizeX=me.AbsoluteSize.X				--script.Sample.AbsoluteSize.X
sizeY=script.Sample.AbsoluteSize.Y
if sizeX>sizeY then
	sizeY=sizeX
else
	sizeX=sizeY
end

anchor=Vector2.new(0.5,0.5)

for i,img in pairs(tmp) do
	str=string.sub(img.Name,1,3)
	if str =="img" then
		smp=sample:Clone()
		smp.Size=UDim2.new(0,sizeX,0,sizeY)

		local btn=img
		btn.AnchorPoint=anchor
		btn.Position=UDim2.new(0.5,0,0.5,0)
		btn.Size=UDim2.new(0.7,0,0.8,0)
		btn.Parent=smp
		smp.Parent=me.Frame
	end
end
