Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local seed = math.random(1,1000)
- local MAPSIZE = 300
- local MAPHEIGHT = 8 -- Increasing the map height might break the game
- local chunks = {}
- local MAPSCALE = MAPSIZE/2
- local maxTrees = 100 * MAPSIZE
- local function generateTrees(block)
- local tree = script.Parent.Tree:Clone()
- tree.Parent = game.Workspace.Trees
- tree:SetPrimaryPartCFrame(block.CFrame)
- -- result
- return block
- end
- for x = MAPSCALE-MAPSCALE-MAPSCALE, MAPSCALE do
- for z = MAPSCALE-MAPSCALE-MAPSCALE, MAPSCALE do
- local noise = math.noise(seed, x/20,z/20)*MAPHEIGHT
- local block = script.Parent.Block:Clone()
- block.Position = Vector3.new(x*4,math.floor(noise)*4,z*4)
- block.Parent = game.Workspace.MapGeneration
- if block.Position.Y > 5 then
- -- Brown
- block.Color = Color3.fromRGB(97, 97, 97)
- elseif block.Position.Y >= -1 then
- block.Color = Color3.fromRGB(65, 38, 0)
- elseif block.Position.Y < -4 then
- block.Color = Color3.fromRGB(255, 226, 158)
- end
- -- SNOW
- if block.Position.Y >= 16 then
- block.Color = Color3.new(1, 1, 1)
- end
- table.insert(chunks, block)
- end
- end
- for i = 1,maxTrees-1,1 do
- local randomBlock = game.Workspace.MapGeneration:GetChildren()[math.random(1,#game.Workspace.MapGeneration:GetChildren())]
- generateTrees(randomBlock)
- end
Advertisement
Add Comment
Please, Sign In to add comment