RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a high quality landscape"
-- server script local landscape = game.Workspace.Landscape local terrain = game.Workspace.Terrain local terrainSize = terrain.TerrainSize local terrainCells = terrain.TerrainCells local terrainCellSize = terrain.CellSize local heightMap = terrain.HeightMap -- Create a 2D array to store the height values local heightValues = {} for x = 0, terrainSize.X - 1 do heightValues[x] = {} for z = 0, terrainSize.Z - 1 do heightValues[x][z] = 0 end end -- Set the height values for x = 0, terrainSize.X - 1 do for z = 0, terrainSize.Z - 1 do local cellIndex = x * terrainSize.Z z local cell = terrainCells:GetCell(cellIndex) local height = heightMap:GetHeight(cell.X, cell.Y) heightValues[x][z] = height end end -- Create the landscape for x = 0, terrainSize.X - 1 do for z = 0, terrainSize.Z - 1 do local cellIndex = x * terrainSize.Z z local cell = terrainCells:GetCell(cellIndex) local height = heightValues[x][z] local part = Instance.new("Part") part.Parent = landscape part.Size = Vector3.new(terrainCellSize, terrainCellSize, terrainCellSize) part.Position = Vector3.new(cell.X, height, cell.Y) end end