Advertisement
Guest User

Epic Hidden Devs Scripter Role Application Thing

a guest
Feb 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. --[[
  2.     Rex (aka EDmaster24)'s 3p7c Part Generator w/ perlin noise :sunglasses: Did it locally like a cool kid :sunglasses:
  3.     Also, because sending a message to the server to instance would lag more and it's a showcase.
  4.     Plus; each person's terrain would most likely be different!
  5. --]]
  6. local UIS = game:GetService('UserInputService')
  7. local scale = 1.5
  8. local genSize = 450
  9. local heightFactor = 5
  10.  
  11. local function instPart(pos)
  12.     local part = Instance.new('Part')
  13.     part.Name = "ProceduralTerrainPart"
  14.     part.Shape = "Block"
  15.     part.Anchored = true
  16.     part.Material = Enum.Material.Sand
  17.     part.BrickColor = BrickColor.new("Beige")
  18.     part.CFrame = CFrame.new(pos - Vector3.new(0,pos.Y/2,0))
  19.     part.Size = Vector3.new(scale,pos.Y,scale)
  20.     part.Parent = workspace
  21. end
  22.  
  23. local function load()
  24.     local parts = workspace:GetChildren()
  25.     for i = 1,#parts do
  26.         if parts[i].ClassName == 'Part' then
  27.             parts[i]:Destroy()
  28.         end
  29.     end
  30.     local seed = (math.random(1,10000))/100
  31.     print("SEED:"..seed)
  32.     for x = 1,genSize,scale do
  33.         for z = 1,genSize,scale do
  34.             instPart(Vector3.new(x,(scale + math.noise(x/10,z/10,seed))/2 * scale * heightFactor,z))
  35.         end
  36.     end
  37. end
  38. UIS.InputBegan:Connect(function(inp,gameproc)
  39.     if inp.KeyCode == Enum.KeyCode.L and not gameproc then
  40.         load()
  41.     end
  42. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement