Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Made by Dev_Ryan (Roblox Dev) - Nov. 20, 2017
- -- settings:
- local xSize = 512 -- ideal: ~500
- local ySize = 512 -- ideal: ~500
- local scale = 16 -- ideal: ~20 (spacing between dots)
- local spread = 32 -- ideal: ~20 (how high dots go)
- local speed = 0.05 -- ideal: ~0.05 (while wait(speed) do)
- local flySpeed = 0.02 -- ideal: ~0.05 (0.1 is slightly faster)
- local offset = 0.2 -- ideal: ~0.2 (spike width)
- local color = BrickColor.new("Cyan") -- color of dots and lines
- ---------- Dont really need to change anything below.. ------------------
- -- (yes I know I am not using the best methods but its something to work from..)
- local boolName = "Start/Stop"
- if workspace:FindFirstChild(boolName) then workspace[boolName]:Destroy() end
- local BV = Instance.new("BoolValue") -- click this in workspace to start/stop the animation.
- BV.Name = boolName
- BV.Parent = workspace
- local noiseTbl = {}
- local terrainTbl = {}
- local folderName = "TerrainData"
- if workspace:FindFirstChild(folderName) then workspace[folderName]:Destroy() end
- local terrainFolder = Instance.new("Folder")
- terrainFolder.Name = folderName
- terrainFolder.Parent = workspace
- local cf = CFrame.new
- local function createRope(p1, p2)
- local a1 = Instance.new("Attachment")
- a1.Parent = p1
- local a2 = Instance.new("Attachment")
- a2.Parent = p2
- local rope = Instance.new("RopeConstraint")
- rope.Color = color
- rope.Thickness = 0.5
- rope.Parent = p1
- rope.Attachment0 = a1
- rope.Attachment1 = a2
- rope.Visible = true
- end
- local rows = 0 -- keep zero
- local columns = 0 -- keep zero
- local function setup()
- columns = xSize / scale
- rows = ySize / scale
- for x = 1, columns do
- noiseTbl[columns] = {}
- for y = 1, rows do
- noiseTbl[columns][rows] = 0
- end
- end
- local p = Instance.new("Part")
- p.BrickColor = color
- p.Material = Enum.Material.SmoothPlastic -- Enum.Material.Neon
- p.Size = Vector3.new(1,1,1)
- p.Shape = Enum.PartType.Ball
- p.TopSurface = Enum.SurfaceType.Smooth
- p.BottomSurface = Enum.SurfaceType.Smooth
- p.Anchored = true
- p.CanCollide = false
- p.Parent = terrainFolder
- for xpos = 1, columns do wait()
- terrainTbl[xpos] = {}
- for ypos = 1, rows do
- local c = p:Clone()
- c.Parent = terrainFolder
- c.CFrame = cf((xpos*scale)-(xSize/2), 0, (ypos*scale)-(ySize/2))
- terrainTbl[xpos][ypos] = c
- if xpos > 1 then
- createRope(c, terrainTbl[xpos-1][ypos])
- end
- if ypos > 1 then
- createRope(c, terrainTbl[xpos][ypos-1])
- end
- if xpos > 1 and ypos > 1 then
- createRope(c, terrainTbl[xpos-1][ypos-1])
- end
- end
- end
- wait()
- p:Destroy()
- end
- setup()
- local noise = math.noise
- local clamp = math.clamp
- local function getNoise(x,y)
- local n = noise(x,y)
- n = n * spread
- n = clamp(n, -spread, spread)
- return n
- end
- repeat wait(1) until BV.Value
- print("Started!")
- local flying = 0 -- keep zero.
- while true do wait(speed)
- if not BV.Value then
- print("Paused!")
- repeat wait(1) until BV.Value
- print("Resumed!")
- end
- flying = flying - flySpeed
- local yOffset = flying
- for y = 1, rows-1 do
- local xOffset = 0
- for x = 1, columns-1 do
- if type(terrainTbl[x][y]) == "userdata" then
- local getcf = terrainTbl[x][y].CFrame
- if getcf then
- terrainTbl[x][y].CFrame = cf(getcf.x, getNoise(xOffset,yOffset), getcf.z)
- end
- end
- xOffset = xOffset + offset
- end
- yOffset = yOffset + offset
- end
- end
- print("Stopped!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement