me=script.Parent wnd=me.Parent ui=me.Frame.UI sample=script.Sample:Clone()local F=me:GetChildren()local y=0 for F,t in pairs(F)do str=string.sub(t.Name,1,3)if str=="\105\109\103"then y=y+1 end end sizeX=me.AbsoluteSize.X sizeY=script.Sample.AbsoluteSize.Y if sizeX>sizeY then sizeY=sizeX else sizeX=sizeY end anchor=Vector2.new(.5,.5)for F,y in pairs(F)do str=string.sub(y.Name,1,3)if str=="\105\109\103"then smp=sample:Clone()smp.Size=UDim2.new(0,sizeX,0,sizeY)local F=y F.AnchorPoint=anchor F.Position=UDim2.new(.5,0,.5,0)F.Size=UDim2.new(.7,0,.8,0)F.Parent=smp smp.Parent=me.Frame end end


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
