Guest User

Untitled

a guest
Apr 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.35 KB | None | 0 0
  1. -- Original by Roblox.  Edited by ArceusInator to include water.
  2.  
  3. -- Local function definitions
  4. local c = game.Workspace.Terrain
  5. local SetCell = c.SetCell
  6. local GetCell = c.GetCell
  7. local SetCells = c.SetCells
  8. local AutoWedge = c.AutowedgeCells
  9.  
  10.  
  11. -----------------
  12. --DEFAULT VALUES-
  13. -----------------
  14. loaded = false
  15. xpos = 0
  16. zpos = 0
  17. width = 512
  18. length = 512
  19. a = 30
  20. f = 8
  21. on = false
  22.  
  23.  
  24.  
  25.  
  26. ---------------
  27. --PLUGIN SETUP-
  28. ---------------
  29. self = PluginManager():CreatePlugin()
  30. self.Deactivation:connect(function()
  31.     Off()
  32. end)
  33. toolbar = self:CreateToolbar("Terrain")
  34. toolbarbutton = toolbar:CreateButton("", "Terrain Generator", "terrain.png")
  35. toolbarbutton.Click:connect(function()
  36.     if on then
  37.         Off()
  38.     elseif loaded then
  39.         On()
  40.     end
  41. end)
  42.  
  43.  
  44.  
  45.  
  46. -----------------------
  47. --FUNCTION DEFINITIONS-
  48. -----------------------
  49.  
  50. --makes a column of blocks from 1 up to height at location (x,z) in cluster c
  51. function coordHeight(x, z, height)
  52.     SetCells(c, Region3int16.new(Vector3int16.new(x, 1, z), Vector3int16.new(x, height, z)), 1, 0, 0)
  53. end
  54.  
  55. --makes a heightmap for a layer of mountains (width x depth)
  56. --with a width frequency wf and depthfrequency df (width should be divisible by wf, depth should be divisible by df) (for unsquished results, width/wf = depth/df)
  57. --with a range of amplitudes between 0 and a
  58. function mountLayer(width, depth, wf, df, a)
  59.     local heightmap = {}
  60.     for i = 0, width-1 do
  61.         heightmap[i] = {}
  62.         for k = 0, depth-1 do
  63.             heightmap[i][k] = 0
  64.         end
  65.     end
  66.     math.randomseed(tick())
  67.     local corners = {}
  68.     for i = 0,wf do
  69.         corners[i] = {}
  70.         for k = 0, df do
  71.             corners[i][k] = a*math.random()
  72.         end
  73.     end
  74.     for i = 0, wf do
  75.         corners[i][0] = 0
  76.         corners[i][math.floor(df)] = 0
  77.     end
  78.     for k = 0, df do
  79.         corners[0][k]=0
  80.         corners[math.floor(wf)][k]=0
  81.     end
  82.  
  83.     for i = 0, width-(width/wf), width/wf do
  84.         for k = 0, depth-(depth/df), depth/df do
  85.             local c1 = corners[i/(width/wf)][k/(depth/df)]
  86.             local c2 = corners[i/(width/wf)][(k+depth/df)/(depth/df)]
  87.             local c3 = corners[(i+width/wf)/(width/wf)][k/(depth/df)]
  88.             local c4 = corners[(i+width/wf)/(width/wf)][(k+depth/df)/(depth/df)]
  89.             for x = i, i+(width/wf)-1 do
  90.                 for z = k, k+(depth/df)-1 do
  91.                     local avgc1c3 = (math.abs(x-i)*c3 + math.abs(x-(i+width/wf))*c1)/(width/wf)
  92.                     local avgc2c4 = (math.abs(x-i)*c4 + math.abs(x-(i+width/wf))*c2)/(width/wf)
  93.                     local avg = math.floor((math.abs(z-k)*avgc2c4 + math.abs(z-(k+depth/df))*avgc1c3)/(depth/df))
  94.                     if (avg > 100) then
  95.                         print(avg)
  96.                         avg = 1
  97.                     end
  98.                     heightmap[x][z]= avg
  99.                 end
  100.             end
  101.         end
  102.     end
  103.     return heightmap
  104. end
  105.  
  106. --makes a shell around block at coordinate x, z using heightmap
  107. function makeShell(x, z, heightmap, shellheightmap)
  108.     local originalheight = heightmap[x][z]
  109.     for i = x - 1, x + 1 do
  110.         for k = z - 1, z + 1 do
  111.             if shellheightmap[i][k] < originalheight then
  112.                 for h = originalheight, shellheightmap[i][k] - 2, -1 do
  113.                     if h > 0 then
  114.                         SetCell(c, i, h, k, 1, 0, 0)
  115.                     end
  116.                 end
  117.                 shellheightmap[i][k] = originalheight
  118.             end
  119.         end
  120.     end
  121.     return shellheightmap
  122. end
  123.  
  124.  
  125. function onGenerate()
  126.     generate.BorderColor3 = Color3.new(0, 0, 0)
  127.     generate.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  128.     generate.BackgroundTransparency = 0.5
  129.     frame.Visible = false
  130.     toolbarbutton:SetActive(false)
  131.     on = false
  132.     if g:FindFirstChild("gload") == nil then
  133.         gload = Instance.new("Frame", g)
  134.         gload.Name = "gload"
  135.         gload.Position = UDim2.new(0.4, 0, 0.025, 0)
  136.         gload.Size = UDim2.new(0.2, 0, 0.05, 0)
  137.         gload.BackgroundTransparency = 0.5
  138.         gfill = Instance.new("Frame", gload)
  139.         gfill.Name = "gfill"
  140.         gfill.Position = UDim2.new(0, 0, 0, 0)
  141.         gfill.Size = UDim2.new(0, 0, 1, 0)
  142.         gfill.BackgroundColor3 = Color3.new(1, 0.25, 0)
  143.         gfill.BackgroundTransparency = 0.5
  144.         gloadstatus = Instance.new("TextLabel", gload)
  145.         gloadstatus.Position = UDim2.new(0.4, 0, 0.4, 0)
  146.         gloadstatus.Size = UDim2.new(0.2, 0, 0.2, 0)
  147.         gloadstatus.Text = ""
  148.         gloadstatus.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  149.         gloadstatus.TextColor3 = Color3.new(1, 1, 1)
  150.         gloadstatus.Font = Enum.Font.ArialBold
  151.         gloadstatus.FontSize = Enum.FontSize.Size14
  152.         gloadstatus.BorderColor3 = Color3.new(0, 0, 0)
  153.         gloadstatus.BackgroundTransparency = 1
  154.     else
  155.         gload = g:FindFirstChild("gload")
  156.         gfill = gload:FindFirstChild("gfill")
  157.         gload.Visible = 1
  158.         gfill.Visible = 1
  159.         gfill.Size = UDim2.new(0, 0, 1, 0)
  160.         gloadstatus.Text = ""
  161.     end
  162.  
  163.     --Generate Terrain
  164.     -- offset terrain additionally by whatever the smallest cell is
  165.     --xpos2 = xpos + game.Workspace.Terrain.MaxExtents.Min.X
  166.     --zpos2 = zpos + game.Workspace.Terrain.MaxExtents.Min.Z
  167.     xpos2 = xpos - width/2
  168.     zpos2 = zpos - length/2
  169.  
  170.     -- "bump" camera up to 200 studs if it was not before
  171.     if game.Workspace.CurrentCamera.CoordinateFrame.p.Y < 200 then game.Workspace.CurrentCamera.CoordinateFrame = game.Workspace.CurrentCamera.CoordinateFrame + Vector3.new(0, 200 - game.Workspace.CurrentCamera.CoordinateFrame.p.Y, 0) end
  172.  
  173.     --make 3 layers of mountains (you can change the frequency and amplitude of each layer and add or remove layers as you see fit (but don't forget to add the new layers to the loop below)
  174.     a1 = mountLayer(width, length, f*width/512, f*length/512, 3/5*a)
  175.     a2 = mountLayer(width, length, 2*f*width/512, 2*f*length/512, 2/5*a)
  176.     heightmap = {}
  177.     for x = 0, width - 1 do
  178.         heightmap[x + xpos2] = {}
  179.         for z = 0, length - 1 do
  180.             heightmap[x + xpos2][z + zpos2] = a1[x][z] + a2[x][z]
  181.         end
  182.     end
  183.     shellheightmap = {}
  184.     for x = 0, width - 1 do
  185.         shellheightmap[x + xpos2] = {}
  186.         for z = 0, length - 1 do
  187.             shellheightmap[x + xpos2][z + zpos2] = heightmap[x + xpos2][z + zpos2]
  188.         end
  189.     end
  190.     gprogress = 0
  191.     gloadstatus.Text = "Generating Terrain Shape..."
  192.     k = 1 + zpos2
  193.  
  194.     local waitCount = 0
  195.  
  196.     while k < length - 1 + zpos2 do
  197.         for x = 1 + xpos2, width - 2 + xpos2 do
  198.             coordHeight(x, k, heightmap[x][k])
  199.             shellheightmap = makeShell(x, k, heightmap, shellheightmap)
  200.         end
  201.         k = k + 1
  202.         gprogress = gprogress + 2/(length * 3)
  203.         gfill.Size = UDim2.new(gprogress, 0, 1, 0)
  204.         if waitCount > 5 then waitCount = 0 wait(0.01) else waitCount = waitCount + 1 end
  205.     end
  206.     gloadstatus.Text = "Smoothing Terrain..."
  207.     k = 1 + zpos2
  208.     waitCount = 0
  209.     local maxHeight = -1
  210.     local oldK = k
  211.     while k < length - 1 + zpos2 do
  212.         for x = 1 + xpos2, width - 2 + xpos2 do
  213.             height = shellheightmap[x][k]
  214.             if height == nil then
  215.                 height = -1
  216.             end
  217.             if height > maxHeight then
  218.                 maxHeight = height
  219.             end
  220.         end
  221.         k = k + 1
  222.         gprogress = gprogress + 1/(length * 3)
  223.         gfill.Size = UDim2.new(gprogress, 0, 1, 0)
  224.         if waitCount > 10 then
  225.             waitCount = 0
  226.             AutoWedge(c, Region3int16.new(Vector3int16.new(1 + xpos2, 0, oldK), Vector3int16.new(width - 2 + xpos2, maxHeight, k)))
  227.             oldK = k+1
  228.             maxHeight = -1
  229.             wait()
  230.         else waitCount = waitCount + 1 end
  231.         if k == length - 2 + zpos2 then
  232.             AutoWedge(c, Region3int16.new(Vector3int16.new(1 + xpos2, 0, oldK), Vector3int16.new(width - 2 + xpos2, maxHeight, k)))
  233.  
  234.             gfill.Parent.Visible = false
  235.             gfill.Visible = false
  236.         end
  237.     end
  238.     gloadstatus.Text = "Watering Land..."
  239.     gfill.BackgroundColor3 = Color3.new(0,0,1)
  240.    
  241.     for v = 1,4 do
  242.         for x = 1, width do
  243.             assert(coroutine.resume(coroutine.create(function()
  244.             for z = 1, length do
  245.                 wait()
  246.                 for y = 1, 5 do
  247.                     if tostring(workspace.Terrain:GetCell(x,20-y,z)) == "Enum.CellMaterial.Empty" then
  248.                         game:GetService("WaterRegionOwners"):AddWaterAt(v == 2 and -x or v == 4 and -x or x-1,20-y,v == 3 and -z or v == 4 and -z or z-1)
  249.                     end
  250.                 end
  251.             end
  252.             end)))
  253.         end
  254.     end
  255.     --Generate Terrain End
  256. end
  257.  
  258. function onReset()
  259.     reset.BorderColor3 = Color3.new(0, 0, 0)
  260.     reset.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  261.     reset.BackgroundTransparency = 0.5
  262.     frame.Visible = false
  263.     toolbarbutton:SetActive(false)
  264.     on = false
  265.    
  266.     if g:FindFirstChild("rload") == nil then
  267.         rload = Instance.new("Frame", g)
  268.         rload.Name = "rload"
  269.         rload.Position = UDim2.new(0.4, 0, 0.025, 0)
  270.         rload.Size = UDim2.new(0.2, 0, 0.05, 0)
  271.         rload.BackgroundTransparency = 0.5
  272.         rfill = Instance.new("Frame", rload)
  273.         rfill.Name = "rfill"
  274.         rfill.Position = UDim2.new(0, 0, 0, 0)
  275.         rfill.Size = UDim2.new(0, 0, 1, 0)
  276.         rfill.BackgroundColor3 = Color3.new(1, 0.25, 0)
  277.         rfill.BackgroundTransparency = 0.5
  278.     else
  279.         rload = g:FindFirstChild("rload")
  280.         rfill = rload:FindFirstChild("rfill")
  281.         rload.Visible = 1
  282.         rfill.Visible = 1
  283.         rfill.Size = UDim2.new(0, 0, 1, 0)
  284.     end
  285.     --Erase Terrain
  286.    
  287.     local xMax = c.MaxExtents.Max.X
  288.     local yMax = c.MaxExtents.Max.Y
  289.     local zMax = c.MaxExtents.Max.Z
  290.  
  291.     local xMin = c.MaxExtents.Min.X
  292.     local yMin = c.MaxExtents.Min.Y
  293.     local zMin = c.MaxExtents.Min.Z
  294.  
  295.  
  296.     rprogress = 0
  297.    
  298.     local waitCount = 0
  299.  
  300.     z = zMax
  301.     while z >= zMin do
  302.         SetCells(c, Region3int16.new(Vector3int16.new(xMin, yMin, z), Vector3int16.new(xMax, yMax, z)), 0, 0, 0)
  303.         z = z - 1
  304.  
  305.         rprogress = rprogress + 1/(zMax - zMin + 1)
  306.         rfill.Size = UDim2.new(rprogress, 0, 1, 0)
  307.         if z == zMin then
  308.             reset.BorderColor3 = Color3.new(0, 0, 0)
  309.             rfill.Parent.Visible = false
  310.             rfill.Visible = false
  311.         end
  312.         if waitCount > 5 then waitCount = 0 wait(0.001) else waitCount = waitCount + 1 end
  313.     end
  314.    
  315.     --Erase Terrain End
  316. end
  317.  
  318. function On()
  319.     self:Activate(true)
  320.     toolbarbutton:SetActive(true)
  321.     frame.Visible = true
  322.     for w = 0, 0.6, 0.1 do
  323.         frame.Size = UDim2.new(w, 0, w + 0.2, 0)
  324.         wait(0.0000001)
  325.     end
  326.     title.Text = "Terrain Generation"
  327.     xposl.Text = "X-Offset: "..xpos
  328.     zposl.Text = "Z-Offset: "..zpos
  329.     widthl.Text = "Width: "..width
  330.     lengthl.Text = "Length: "..length
  331.     ampl.Text = "Amplitude: "..a
  332.     freql.Text = "Frequency: "..f
  333.     generate.Text = "Generate"
  334.     reset.Text = "Reset"
  335.     on = true
  336.    
  337.     onGenerate()
  338. end
  339.  
  340. function Off()
  341.     toolbarbutton:SetActive(false)
  342.     title.Text = ""
  343.     xposl.Text = ""
  344.     zposl.Text = ""
  345.     widthl.Text = ""
  346.     lengthl.Text = ""
  347.     ampl.Text = ""
  348.     freql.Text = ""
  349.     generate.Text = ""
  350.     reset.Text = ""
  351.     for w = 0.6, 0, -0.1 do
  352.         frame.Size = UDim2.new(w, 0, w + 0.2, 0)
  353.         wait(0.0000001)
  354.     end
  355.     frame.Visible = false
  356.     on = false
  357. end
  358.  
  359.  
  360.  
  361.  
  362. ------
  363. --GUI-
  364. ------
  365.  
  366. --load library for with sliders
  367. local RbxGui = LoadLibrary("RbxGui")
  368.  
  369. --screengui
  370. g = Instance.new("ScreenGui", game:GetService("CoreGui"))
  371.  
  372. --frame
  373. frame = Instance.new("Frame", g)
  374. frame.Size = UDim2.new(0.6, 0, 0.8, 0)
  375. frame.Position = UDim2.new(0.2, 0, 0.1, 0)
  376. frame.BackgroundTransparency = 0.5
  377. frame.Visible = false
  378.  
  379. --title
  380. title = Instance.new("TextLabel", frame)
  381. title.Position = UDim2.new(0.4, 0, 0.05, 0)
  382. title.Size = UDim2.new(0.2, 0, 0.05, 0)
  383. title.Text = ""
  384. title.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  385. title.TextColor3 = Color3.new(1, 1, 1)
  386. title.Font = Enum.Font.ArialBold
  387. title.FontSize = Enum.FontSize.Size24
  388. title.BorderColor3 = Color3.new(0, 0, 0)
  389. title.BackgroundTransparency = 1
  390.  
  391. --current xoffset display label
  392. xposl = Instance.new("TextLabel", frame)
  393. xposl.Position = UDim2.new(0.05, 0, 0.2, 0)
  394. xposl.Size = UDim2.new(0.1, 0, 0.05, 0)
  395. xposl.Text = ""
  396. xposl.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  397. xposl.TextColor3 = Color3.new(1, 1, 1)
  398. xposl.Font = Enum.Font.ArialBold
  399. xposl.FontSize = Enum.FontSize.Size14
  400. xposl.BorderColor3 = Color3.new(0, 0, 0)
  401. xposl.BackgroundTransparency = 1
  402.  
  403. --xoffset slider
  404. xposSliderGui, xposSliderPosition = RbxGui.CreateSlider(128, 0, UDim2.new(0.2, 0, 0.22, 0))
  405. xposSliderGui.Parent = frame
  406. xposBar = xposSliderGui:FindFirstChild("Bar")
  407. xposBar.Size = UDim2.new(0.75, 0, 0, 5)
  408. xposSliderPosition.Value = (xpos+252)/4 + 1
  409. xposSliderPosition.Changed:connect(function()
  410.     xpos = (xposSliderPosition.Value - 1) * 4 - 252
  411.     xposl.Text = "X-Offset: "..xpos
  412. end)
  413.  
  414. --current zoffset display label
  415. zposl = Instance.new("TextLabel", frame)
  416. zposl.Position = UDim2.new(0.05, 0, 0.3, 0)
  417. zposl.Size = UDim2.new(0.1, 0, 0.05, 0)
  418. zposl.Text = ""
  419. zposl.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  420. zposl.TextColor3 = Color3.new(1, 1, 1)
  421. zposl.Font = Enum.Font.ArialBold
  422. zposl.FontSize = Enum.FontSize.Size14
  423. zposl.BorderColor3 = Color3.new(0, 0, 0)
  424. zposl.BackgroundTransparency = 1
  425.  
  426. --zoffset slider
  427. zposSliderGui, zposSliderPosition = RbxGui.CreateSlider(128, 0, UDim2.new(0.2, 0, 0.32, 0))
  428. zposSliderGui.Parent = frame
  429. zposBar = zposSliderGui:FindFirstChild("Bar")
  430. zposBar.Size = UDim2.new(0.75, 0, 0, 5)
  431. zposSliderPosition.Value = (zpos+252)/4 + 1
  432. zposSliderPosition.Changed:connect(function()
  433.     zpos = (zposSliderPosition.Value - 1) * 4 - 252
  434.     zposl.Text = "Z-Offset: "..zpos
  435. end)
  436.  
  437. --current width display label
  438. widthl = Instance.new("TextLabel", frame)
  439. widthl.Position = UDim2.new(0.05, 0, 0.4, 0)
  440. widthl.Size = UDim2.new(0.1, 0, 0.05, 0)
  441. widthl.Text = ""
  442. widthl.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  443. widthl.TextColor3 = Color3.new(1, 1, 1)
  444. widthl.Font = Enum.Font.ArialBold
  445. widthl.FontSize = Enum.FontSize.Size14
  446. widthl.BorderColor3 = Color3.new(0, 0, 0)
  447. widthl.BackgroundTransparency = 1
  448.  
  449. --width slider
  450. widthSliderGui, widthSliderPosition = RbxGui.CreateSlider(4, 0, UDim2.new(0.2, 0, 0.42, 0))
  451. widthSliderGui.Parent = frame
  452. widthbar = widthSliderGui:FindFirstChild("Bar")
  453. widthbar.Size = UDim2.new(0.75, 0, 0, 5)
  454. widthSliderPosition.Value = 4
  455. widthSliderPosition.Changed:connect(function()
  456.     width = math.pow(2, widthSliderPosition.Value + 5)
  457.     widthl.Text = "Width: "..width
  458. end)
  459.  
  460. --current length display label
  461. lengthl = Instance.new("TextLabel", frame)
  462. lengthl.Position = UDim2.new(0.05, 0, 0.5, 0)
  463. lengthl.Size = UDim2.new(0.1, 0, 0.05, 0)
  464. lengthl.Text = ""
  465. lengthl.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  466. lengthl.TextColor3 = Color3.new(1, 1, 1)
  467. lengthl.Font = Enum.Font.ArialBold
  468. lengthl.FontSize = Enum.FontSize.Size14
  469. lengthl.BorderColor3 = Color3.new(0, 0, 0)
  470. lengthl.BackgroundTransparency = 1
  471.  
  472. --length slider
  473. lengthSliderGui, lengthSliderPosition = RbxGui.CreateSlider(4, 0, UDim2.new(0.2, 0, 0.52, 0))
  474. lengthSliderGui.Parent = frame
  475. lengthbar = lengthSliderGui:FindFirstChild("Bar")
  476. lengthbar.Size = UDim2.new(0.75, 0, 0, 5)
  477. lengthSliderPosition.Value = 4
  478. lengthSliderPosition.Changed:connect(function()
  479.     length = math.pow(2, lengthSliderPosition.Value + 5)
  480.     lengthl.Text = "Length: "..length
  481. end)
  482.  
  483. --current amplitude display label
  484. ampl = Instance.new("TextLabel", frame)
  485. ampl.Position = UDim2.new(0.05, 0, 0.6, 0)
  486. ampl.Size = UDim2.new(0.1, 0, 0.05, 0)
  487. ampl.Text = ""
  488. ampl.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  489. ampl.TextColor3 = Color3.new(1, 1, 1)
  490. ampl.Font = Enum.Font.ArialBold
  491. ampl.FontSize = Enum.FontSize.Size14
  492. ampl.BorderColor3 = Color3.new(0, 0, 0)
  493. ampl.BackgroundTransparency = 1
  494.  
  495. --amplitude slider
  496. ampSliderGui, ampSliderPosition = RbxGui.CreateSlider(62, 0, UDim2.new(0.2, 0, 0.62, 0))
  497. ampSliderGui.Parent = frame
  498. ampbar = ampSliderGui:FindFirstChild("Bar")
  499. ampbar.Size = UDim2.new(0.75, 0, 0, 5)
  500. ampSliderPosition.Value = a + 1
  501. ampSliderPosition.Changed:connect(function()
  502.     a = ampSliderPosition.Value + 1
  503.     ampl.Text = "Amplitude: "..a
  504. end)
  505.  
  506. --current frequency display label
  507. freql = Instance.new("TextLabel", frame)
  508. freql.Position = UDim2.new(0.05, 0, 0.7, 0)
  509. freql.Size = UDim2.new(0.1, 0, 0.05, 0)
  510. freql.Text = ""
  511. freql.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  512. freql.TextColor3 = Color3.new(1, 1, 1)
  513. freql.Font = Enum.Font.ArialBold
  514. freql.FontSize = Enum.FontSize.Size14
  515. freql.BorderColor3 = Color3.new(0, 0, 0)
  516. freql.BackgroundTransparency = 1
  517.  
  518. --frequency slider
  519. freqSliderGui, freqSliderPosition = RbxGui.CreateSlider(8, 0, UDim2.new(0.2, 0, 0.72, 0))
  520. freqSliderGui.Parent = frame
  521. freqbar = freqSliderGui:FindFirstChild("Bar")
  522. freqbar.Size = UDim2.new(0.75, 0, 0, 5)
  523. freqSliderPosition.Value = 4
  524. freqSliderPosition.Changed:connect(function()
  525.     f = math.pow(2, freqSliderPosition.Value - 1)
  526.     freql.Text = "Frequency: "..f
  527. end)
  528.  
  529. --generate button
  530. generate = Instance.new("TextButton", frame)
  531. generate.Position = UDim2.new(0.275, 0, 0.85, 0)
  532. generate.Size = UDim2.new(0.2, 0, 0.1, 0)
  533. generate.Text = ""
  534. generate.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  535. generate.TextColor3 = Color3.new(1, 1, 1)
  536. generate.Font = Enum.Font.ArialBold
  537. generate.FontSize = Enum.FontSize.Size14
  538. generate.BorderColor3 = Color3.new(0, 0, 0)
  539. generate.BackgroundTransparency = 0.5
  540. generate.MouseEnter:connect(function()
  541.     generate.BorderColor3 = Color3.new(1, 1, 1)
  542.     generate.BackgroundColor3 = Color3.new(0, 0, 0)
  543.     generate.BackgroundTransparency = 0.2
  544. end)
  545. generate.MouseButton1Click:connect(onGenerate)
  546. generate.MouseLeave:connect(function()
  547.     generate.BorderColor3 = Color3.new(0, 0, 0)
  548.     generate.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  549.     generate.BackgroundTransparency = 0.5
  550. end)
  551.  
  552. --reset button
  553. reset = Instance.new("TextButton", frame)
  554. reset.Position = UDim2.new(0.525, 0, 0.85, 0)
  555. reset.Size = UDim2.new(0.2, 0, 0.1, 0)
  556. reset.Text = ""
  557. reset.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  558. reset.TextColor3 = Color3.new(1, 1, 1)
  559. reset.Font = Enum.Font.ArialBold
  560. reset.FontSize = Enum.FontSize.Size14
  561. reset.BorderColor3 = Color3.new(0, 0, 0)
  562. reset.BackgroundTransparency = 0.5
  563. reset.MouseEnter:connect(function()
  564.     reset.BorderColor3 = Color3.new(1, 1, 1)
  565.     reset.BackgroundColor3 = Color3.new(0, 0, 0)
  566.     reset.BackgroundTransparency = 0.2
  567. end)
  568. reset.MouseButton1Click:connect(onReset)
  569. reset.MouseLeave:connect(function()
  570.     reset.BorderColor3 = Color3.new(0, 0, 0)
  571.     reset.BackgroundColor3 = Color3.new(0.5, 0.5, 0.5)
  572.     reset.BackgroundTransparency = 0.5
  573. end)
  574.  
  575.  
  576.  
  577.  
  578. --------------------------
  579. --SUCCESSFUL LOAD MESSAGE-
  580. --------------------------
  581. loaded = true
  582. print("Terrain Plugin Loaded")
Add Comment
Please, Sign In to add comment