-- dont edit my script prea loser


game:GetService('RunService'):IsRunning()
task.wait(2)
warn('Loaded!')
Instance.new('Folder',workspace).Name = 'Container'
local C = workspace:FindFirstChild('Container')

game:GetService('ReplicatedStorage').MapGenerate.OnServerEvent:Connect(function(t,id)
	if #C:GetChildren() ~= 0 then C:ClearAllChildren() end
	local MapID = (math.floor((tonumber(id))))

	local Materials = {
		'SmoothPlastic',
		'Neon',
		'Ice',
		'Foil',
		'Sand',
		'Wood',
		'Brick',
		'Grass',
		'Glass',
		'Metal',
		'Slate',
		'Fabric',
		'Marble',
		'Pebble',
		'Granite',
		'Plastic',
		'Concrete',
		'ForceField',
		'WoodPlanks',
		'Cobblestone',
		'DiamondPlate'
	}

	game:GetService('ReplicatedStorage').SeedEvent:FireAllClients(MapID)

	local function GetNumbers(x:string)
		local t = {}
		for i=1,#x do
			if i~=1 then 
				t[#t+1] = x:sub(i,i)
			end
		end
		return x:split('')[1]..'.'..table.concat(t,'')
	end


	local r,f,x = 20, 1,100

	for i = 0,x do
		task.wait()
		for v = 0,x do
			local p = Instance.new('Part')
			p.Parent = C
			p.Size = Vector3.new(1,1,1)
			p.Anchored = true
			p.Color = Color3.fromRGB((math.random(1,255)),(math.random(1,255)),(math.random(1,255)))
			p.Material = Enum.Material[Materials[math.random(#Materials)]]
			--p.Color = Color3.fromRGB(0, 0, 255)
			p.Position = Vector3.new(
				i,
				(math.noise(
					i/r*f,
					v/r*f				
					))*((tonumber(GetNumbers(tostring(MapID))))*(10)),
				v
			)
		end
	end

	warn('All Parts:',#C:GetChildren(),'Parts')
end)
