CHoff719

Untitled

Jun 5th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. --[[
  2. Name: Main.lua
  3. Creator: RedstonedLife
  4. Compatiable with FilteringEnabled: No
  5. ]]--
  6.  
  7. -- Variables
  8. local x = 0
  9. local y = 0
  10. local z = 0
  11. local prefabs = game.ServerStorage.Prefabs
  12. local world = Instance.new("Folder", workspace)
  13. world.Name = "World"
  14.  
  15. -- Functions
  16. function DrawBlock(Block,xp,yp,zp)
  17. local newBlock = prefabs[Block]:Clone()
  18. newBlock.Size = Vector3.new(3,3,3) -- No matter what size the block is in prefabs it will be resized to 3x3x3 Studs
  19. newBlock.CFrame = CFrame.new(xp,yp,zp) -- The CFrame of the block (xp,yp,zp) are where we put the x,y,z when we call the function
  20. newBlock.Parent = world
  21. x=x+3
  22. end
  23.  
  24. function Bumps() -- Generates the terrain but its slightly bumpy
  25. while true do
  26. wait() -- If we do not insert the wait() function it will mostly crash your roblox studio if the generated ammount is big
  27. DrawBlock("Grass",x,math.random(0.1,2.5),z)
  28. if(x==32)then -- To get the x==? so you can use it just do ammountOfBlocks * 3 (Same goes for Z and Y)
  29. x=0
  30. z=z+3
  31. end
  32. if(z==32)then
  33. x=0
  34. z=0
  35. break
  36. end
  37. end
  38. end
  39.  
  40. function Flat() -- Generates the terrain but its completely flat
  41. while true do
  42. wait()
  43. DrawBlock("Grass",x,y,z)
  44. if(x==32)then
  45. x=0
  46. z=z+3
  47. end
  48. if(z==32)then
  49. x=0
  50. z=0
  51. break
  52. end
  53. end
  54. end
  55. --Bumps()
  56. --Flat()
Advertisement
Add Comment
Please, Sign In to add comment