Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Remote = Instance.new("RemoteEvent", owner.Character)
- Remote.Name = "G"
- local db
- local o = game.Players.LocalPlayer
- local c = workspace.CurrentCamera
- local sg = Instance.new("ScreenGui", owner.PlayerGui)
- sg.Name = "PN"
- local re = owner.Character:WaitForChild("G")
- local b = Instance.new("TextButton", sg)
- b.Size = UDim2.fromScale(.2 / c.ViewportSize.X, .1 / c.ViewportSize.Y)
- b.Position = UDim2.fromOffset(1000 / c.ViewportSize.X, 600 /c.ViewportSize.Y)
- b.Text = "Generate"
- local r = Instance.new("UICorner")
- r.Parent = b
- NLS([[
- owner.PlayerGui.PN.TextButton.MouseButton1Click:Connect(function()
- owner.Character.G:FireServer()
- end)
- ]], owner.Character)
- local Blocks = {}
- local Tween = game:GetService("TweenService")
- local Settings = {}
- Settings.XIter = 20
- Settings.YIter = 20
- Settings.ZIter = 20
- Settings.XOffset = 0
- Settings.YOffset = 1
- Settings.ZOffset = 0
- Settings.Fill = 0
- Settings.Detail = 7.4
- Settings.Union = true
- Settings.TerrainProperties = {}
- Settings.TerrainProperties.Terrain = false
- Settings.TerrainProperties.Material = Enum.Material.Grass
- Settings.BlockProperties = {}
- Settings.BlockProperties.Size = Vector3.new(4,4,4)
- Settings.BlockProperties.Material = "SmoothPlastic"
- Settings.BlockProperties.Anchored = true
- Settings.BlockProperties.Transparency = 0
- local uh = Instance.new("Part",folder)
- uh.Name = "uh"
- uh.Position = Vector3.new(0,20,0)
- uh.Size = Vector3.new(1,1,1)
- uh.Transparency = 1
- uh.Anchored = true
- local i = TweenInfo.new(
- .8,
- Enum.EasingStyle.Bounce,
- Enum.EasingDirection.Out,
- 0,
- false,
- .1
- )
- local Functions = {}
- function Functions:ThreeDimensionalNoise(x, y, z, folder, seed)
- local noise = math.noise((x + seed) / Settings.Detail, (y + seed) / Settings.Detail, (z + seed) / Settings.Detail) + Settings.Fill
- local cnoise = math.clamp(noise, -0.5, 0.5)
- if cnoise >= 0 then
- local b = Instance.new("SpawnLocation", folder)
- b.Enabled = false
- b.Size = Settings.BlockProperties.Size
- b.Anchored = Settings.BlockProperties.Anchored
- b.Position = owner.Character.HumanoidRootPart.Position + Vector3.new(0,5,0) + Vector3.new(0,(Settings.BlockProperties.Size.Y/2),0)
- b.Color = Color3.new(cnoise + 0.5, cnoise + 0.5, cnoise + 0.5)
- b.Material = Settings.BlockProperties.Material
- b.CanCollide = false
- b.Locked = true
- local t = Tween:Create(b, i, {Position = (Vector3.new(x,y,z) * Settings.BlockProperties.Size) + Vector3.new(Settings.XOffset, Settings.YOffset, Settings.ZOffset)})
- t:Play()
- table.insert(Blocks, b)
- t.Completed:Connect(function()
- b.CanCollide = true
- if Settings.TerrainProperties.Terrain then
- workspace.Terrain:FillBlock(b.CFrame, b.Size, Settings.TerrainProperties.Material)
- b:Destroy()
- end
- end)
- end
- end
- function Functions:MakeFolder(parent)
- return Instance.new("Folder", parent)
- end
- function Functions:GetSeed()
- return math.random(1,10000000)
- end
- Remote.OnServerEvent:Connect(function()
- if not workspace:FindFirstChild("PN") and not db then
- db = true
- local s = Functions:GetSeed()
- local folder = Functions:MakeFolder(workspace)
- folder.Name = "PN"
- for xc = 1,Settings.XIter,1 do
- for yc = 1,Settings.YIter,1 do
- for zc = 1,Settings.YIter,1 do
- local s, e = pcall(function()
- Functions:ThreeDimensionalNoise(xc, yc, zc, folder, s)
- end)
- if e then
- wait(2.5)
- Functions:ThreeDimensionalNoise(xc, yc, zc, folder, s)
- end
- end
- wait()
- end
- wait()
- end
- if Settings.Union then
- local u = uh:UnionAsync(Blocks)
- u.Anchored = true
- u.Name = "Noise"
- u.Parent = folder
- u.Transparency = 0
- end
- wait(.5)
- db = false
- elseif workspace:FindFirstChild("PN") and not db then
- db = true
- local s = Functions:GetSeed()
- workspace:FindFirstChild("PN"):Destroy()
- local folder = Functions:MakeFolder(workspace)
- folder.Name = "PN"
- for xc = 1,Settings.XIter,1 do
- for yc = 1,Settings.YIter,1 do
- for zc = 1,Settings.YIter,1 do
- local s, e = pcall(function()
- Functions:ThreeDimensionalNoise(xc, yc, zc, folder, s)
- end)
- if e then
- wait(2.5)
- Functions:ThreeDimensionalNoise(xc, yc, zc, folder, s)
- end
- end
- wait()
- end
- wait()
- end
- if Settings.Union then
- local u = uh:UnionAsync(Blocks)
- u.Anchored = true
- u.Name = "Noise"
- u.Parent = folder
- u.Transparency = 0
- end
- wait(.5)
- db = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement