Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Rex (aka EDmaster24)'s 3p7c Part Generator w/ perlin noise :sunglasses: Did it locally like a cool kid :sunglasses:
- Also, because sending a message to the server to instance would lag more and it's a showcase.
- Plus; each person's terrain would most likely be different!
- --]]
- local UIS = game:GetService('UserInputService')
- local scale = 1.5
- local genSize = 450
- local heightFactor = 5
- local function instPart(pos)
- local part = Instance.new('Part')
- part.Name = "ProceduralTerrainPart"
- part.Shape = "Block"
- part.Anchored = true
- part.Material = Enum.Material.Sand
- part.BrickColor = BrickColor.new("Beige")
- part.CFrame = CFrame.new(pos - Vector3.new(0,pos.Y/2,0))
- part.Size = Vector3.new(scale,pos.Y,scale)
- part.Parent = workspace
- end
- local function load()
- local parts = workspace:GetChildren()
- for i = 1,#parts do
- if parts[i].ClassName == 'Part' then
- parts[i]:Destroy()
- end
- end
- local seed = (math.random(1,10000))/100
- print("SEED:"..seed)
- for x = 1,genSize,scale do
- for z = 1,genSize,scale do
- instPart(Vector3.new(x,(scale + math.noise(x/10,z/10,seed))/2 * scale * heightFactor,z))
- end
- end
- end
- UIS.InputBegan:Connect(function(inp,gameproc)
- if inp.KeyCode == Enum.KeyCode.L and not gameproc then
- load()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement