lafur

Untitled

Nov 6th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mod = Instance.new("Model")
  2. mod.Parent = game.Workspace.Base
  3. mod.Name = "GenScip"
  4. scale = 10
  5. char1 = {"Dark green", "part", 0, true, scale/2.5}
  6. char2 = {"Reddish brown", "clif", 0, true, scale*1.5,scale*2}
  7. char3 = {"23", "wate", 0.6, false, scale/2.5}
  8. char4 = {"Pastel brown", "sand", 0, true, scale/2.5}
  9. x = 0
  10. z = -100
  11. n1 = 0
  12. n2 = 0
  13. n3 = 0
  14. zonlay = math.random(1,3)
  15. if zonlay == 1 then
  16. n1 = math.random(1,30)
  17. n2 = math.random(40,50)
  18. n3 = math.random(60,100)
  19. end
  20. if zonlay == 2 then
  21. n1 = math.random(60,100)
  22. n2 = math.random(40,50)
  23. n3 = math.random(10, 30)
  24. end
  25. if zonlay == 3 then
  26. n1 = math.random(30,60)
  27. n2 = math.random(1,20)
  28. n3 = math.random(70,100)
  29. end
  30. spawns = 0
  31. trees = 0
  32.  
  33. function decs(p)
  34. m = Instance.new("SpawnLocation")
  35. m.Parent = mod
  36. m.Size = Vector3.new(scale/2,char1[5],scale/2)
  37. m.BrickColor = BrickColor.new("Really black")
  38. m.Anchored = true
  39. m.CFrame = p.CFrame * CFrame.new(0,char1[5]/2,0)
  40. spawns = spawns + 1
  41. end
  42.  
  43. function dect(p)
  44. if p.BrickColor.Name == char1[1] then else return end
  45. m = Instance.new("Part")
  46. m.Parent = mod
  47. m.Name = "Tree"
  48. m.Size = Vector3.new(scale/2,char1[5],scale/2)
  49. m.BrickColor = BrickColor.new("Dark green")
  50. m.Anchored = true
  51. m.CFrame = p.CFrame * CFrame.new(0,p.Size.Y/3,0)
  52. msh = Instance.new("SpecialMesh")
  53. msh.Parent = m
  54. msh.MeshId = "ff54d21ba63ff3073f34fda5cd1be3f1"
  55. msh.TextureId = "http://www.roblox.com/asset/?id=37476561"
  56. msh.Scale = Vector3.new(0.1,0.1,0.1)
  57. trees = trees + 1
  58. end
  59.  
  60.  
  61.  
  62. function decor(par, tab, xb, zb)
  63. number = string.sub(par.Name:lower(), 5)
  64. par.Size = Vector3.new(scale,tab[math.random(5,#tab)],scale)
  65. par.BrickColor = BrickColor.new(tab[1])
  66. par.Transparency = tab[3]
  67. par.CanCollide = tab[4]
  68. if tab[1] == "Reddish brown" then
  69. local variation = math.random(1,100)*-0.04
  70. par.CFrame = CFrame.new(xb,par.Size.Y/1.8+variation,zb)
  71. par.Friction = 0.6
  72. end
  73. if tab[1] == "Dark green" then
  74. local variation = math.random(1,100)*-0.004
  75. par.CFrame = CFrame.new(xb,par.Size.Y/1.5+variation,zb)
  76. par.Friction = 0.6
  77. end
  78. if tab[1] == "23" or tab[1] == "Pastel brown" then
  79. par.CFrame = CFrame.new(xb,par.Size.Y/1.5,zb)
  80. if tab[1] == "23" then
  81. par.Friction = 0.9
  82. end
  83. end
  84. end
  85.  
  86. function scan(part, char, type)
  87. if type == "land" then
  88. tri = mod:GetChildren()
  89. for i = 1, #tri do
  90. if math.ceil((tri[i].Position - part.Position).magnitude) <= 15 then
  91. decor(tri[i], char, tri[i].CFrame.X, tri[i].CFrame.Z)
  92. end
  93. end
  94. elseif type == "water" then
  95. tri = mod:GetChildren()
  96. for i = 1, #tri do
  97. if math.ceil((tri[i].Position - part.Position).magnitude) > 0 and math.ceil((tri[i].Position - part.Position).magnitude) < 20 then
  98. if string.sub(tri[i].Name:lower(), 1, 4) == "part" then else return end
  99. decor(tri[i], char, tri[i].CFrame.X, tri[i].CFrame.Z)
  100. end
  101. if math.ceil((tri[i].Position - part.Position).magnitude) > 20 and math.ceil((tri[i].Position - part.Position).magnitude) < 30 then
  102. if string.sub(tri[i].Name:lower(), 1, 4) == "part" then else return end
  103. decor(tri[i], char4, tri[i].CFrame.X, tri[i].CFrame.Z)
  104. end
  105. end
  106. end
  107. end
  108.  
  109. function forestscan(part)
  110. tri = mod:GetChildren()
  111. for i = 1, #tri do
  112. if math.ceil((tri[i].Position - part.Position).magnitude) < 20 then
  113. if string.sub(tri[i].Name:lower(), 1, 4) == "part" then else return end
  114. dect(tri[i])
  115. end
  116. end
  117. end
  118.  
  119. function createtile(number)
  120. p = Instance.new("Part")
  121. p.Parent = mod
  122. p.Name = "Part" ..tostring(number)
  123. if number == n1 or number == n2 then
  124. p.Name = "Clif" ..tostring(number)
  125. decor(p, char2, x, z)
  126. else
  127. if number == n3 then
  128. p.Name = "Wate" ..tostring(number)
  129. decor(p, char3, x, z)
  130. else
  131. decor(p, char1, x, z)
  132. end
  133. end
  134. p.BottomSurface = "Smooth"
  135. p.TopSurface = "Smooth"
  136. p.Anchored = true
  137. if x >= scale*25 then
  138. x = 0
  139. z = z + scale
  140. elseif x < scale*25 then
  141. x = x + scale
  142. end
  143. end
  144.  
  145. for i = 1, 208 do
  146. wait()
  147. createtile(i)
  148. end
  149. t = mod:GetChildren()
  150. for i = 1, #t do
  151. if string.sub(t[i].Name:lower(), 1, 4) == "clif" then
  152. scan(t[i], char2, "land")
  153. end
  154. if string.sub(t[i].Name:lower(), 1, 4) == "wate" then
  155. scan(t[i], char3, "water")
  156. end
  157. if string.sub(t[i].Name:lower(), 1, 4) == "part" then
  158. local lol = math.random(1,25)
  159. if spawns == 0 and lol == 10 then
  160. decs(t[i])
  161. end
  162. local lol2 = math.random(1,25)
  163. if trees == 0 and lol2 == 20 then
  164. dect(t[i])
  165. forestscan(t[i])
  166. end
  167. end
  168. end
Add Comment
Please, Sign In to add comment