Scriptorz5

world generator

May 6th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. bricks = {}
  2. modul = Instance.new("Model",workspace)
  3. modul.Name = "Landscape"
  4. colors = {"Earth green", "Bright blue"}
  5. x = 0
  6. z = 0
  7. max = 100
  8. repeat
  9. local p = Instance.new("Part",modul)
  10. p.formFactor = "Custom"
  11. p.BrickColor = BrickColor.new(colors[math.random(1,#colors)])
  12. p.Size = Vector3.new(4,1,4)
  13. if p.BrickColor.Name == "Earth green" then
  14. p.Size = Vector3.new(4,math.random(10,25)/10,4)
  15. end
  16. p.Anchored = true
  17. p.CFrame = CFrame.new(x,4,z)
  18. Instance.new("BlockMesh",p)
  19. table.insert(bricks,p)
  20. x = x + p.Size.X
  21. if x > max then
  22. z = z + p.Size.Z
  23. x = 0
  24. end
  25. until z > max
  26. wait(0.3)
  27. for _,v in pairs(bricks) do
  28. wait()
  29. for _,k in pairs(bricks) do
  30. if (v.Position - k.Position).magnitude < v.Size.X*2 then
  31. local hm = math.random(1,2)
  32. if hm == 1 then
  33. k.BrickColor = v.BrickColor
  34. if k.BrickColor == BrickColor.new("Earth green") then
  35. local lol = v.Size.Y*10
  36. local h = k.CFrame
  37. k.Size = Vector3.new(4,math.random(lol*0.85,lol*1.14)/10,4)
  38. k.CFrame = h
  39. end
  40. end
  41. end
  42. end
  43. end
Add Comment
Please, Sign In to add comment