eea

rawnoise

eea
Dec 5th, 2021 (edited)
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. local folder = Instance.new("Folder",script)
  2. folder.Name = "Perlin Folder"
  3. local detail = 15
  4. local amplitude = 15
  5. local xiterations = 100
  6. local ziterations = 100
  7. local seed = math.random(0, 1000000000)
  8. local layerednoise = false
  9. local size = Vector3.new(1,1,1)
  10. local blockmaterial = "SmoothPlastic"
  11. local wavy = true
  12.  
  13. function CreateNoise(xpos,zpos)
  14. local rnoise = math.clamp(math.noise(xpos/detail,zpos/detail,seed), -0.5, 0.5)
  15. local gnoise = math.clamp(math.noise(seed,xpos/detail,zpos/detail), -0.5, 0.5)
  16. local bnoise = math.clamp(math.noise(zpos/detail,seed,xpos/detail), -0.5, 0.5)
  17. local block = Instance.new("SpawnLocation",folder)
  18. block.Enabled = false
  19. block.Size = size
  20. block.Position = Vector3.new(xpos*size.X,(size.X*2)+1,zpos*size.Z)
  21. block.Anchored = true
  22. block.Material = blockmaterial
  23. if layerednoise then
  24. block.Color = Color3.new(((rnoise + gnoise + bnoise)/3)+0.5,((rnoise + gnoise + bnoise)/3)+0.5,((rnoise + gnoise + bnoise)/3)+0.5)
  25. else
  26. block.Color = Color3.new(rnoise+0.5,rnoise+0.5,rnoise+0.5)
  27. end
  28. local nograv = Instance.new("BodyForce",block)
  29. nograv.Force = Vector3.new(0,block:GetMass()*workspace.Gravity,0)
  30. end
  31.  
  32. for xpos = 1,xiterations,1 do
  33. for zpos = 1,ziterations,1 do
  34. local success, erro = pcall(function()
  35. CreateNoise(xpos,zpos)
  36. end)
  37. if erro then
  38. wait(0.6)
  39. CreateNoise(xpos,zpos)
  40. end
  41. end
  42. wait(0.01)
  43. end
Add Comment
Please, Sign In to add comment