local function G(G,v,S)local d=math.noise((G*Configuration.Frequency.Value)/10,(v*Configuration.Frequency.Value)/10,S)*(Random.new()):NextNumber(19.5,20)return d end local function v(G,v,S)local d=S:FindFirstChild(v.X..("\044 "..v.Z))if d then print("\101\120\105\115\116\105\110\103")else local d=Instance.new("\080\097\114\116")d.Parent=S d.Name=v.X..("\044 "..v.Z)d.Anchored=true d.Size=G d.Position=v if d.Position.Y<=-1 then d.Color=Color3.fromRGB(255,220,114)d.Material=Enum.Material.Sand elseif d.Position.Y>-1 and d.Position.Y<=1.25 then d.Color=Color3.fromRGB(100,100,100)d.Material=Enum.Material.Rock else d.Color=Color3.fromRGB(0,85,0)d.Material=Enum.Material.Grass end end end local function S(S,d)if not Chunks:FindFirstChild(S..("\044 "..d))then print(S..("\044 "..d))local u=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")u.Parent=Chunks u.Name=S..("\044 "..d)local t=game.Workspace.Terrain:FillBlock(CFrame.new(S,-10,d),Vector3.new(Configuration.ChunkSize.Value,16,Configuration.ChunkSize.Value),Enum.Material.Water)for S=S+Configuration.ChunkSize.Value/2,(S-Configuration.ChunkSize.Value/2)+4,-Configuration.Grid.Value do for d=d+Configuration.ChunkSize.Value/2,(d-Configuration.ChunkSize.Value/2)+4,-Configuration.Grid.Value do local t=G(S,d)v(Configuration.GrassSize.Value,Vector3.new(S,t,d),u)end task.wait()end end end if not Chunks:FindFirstChild("\048\044 \048")then S(0,0)end

local function CreateNoise(GridX, GridZ, Seed)
	local GridY = math.noise(
		(GridX * Configuration.Frequency.Value) / 10,
		(GridZ * Configuration.Frequency.Value) / 10,
		Seed
	) * Random.new():NextNumber(19.5, 20)
		
	return (GridY)
end

local function CreateNewGrass(Size, Position, Parent)
	local ExistingBlock = Parent:FindFirstChild(Position.X..", "..Position.Z)
	
	if ExistingBlock then
		print("existing")
		
	else
		local Block = Instance.new("Part")
		Block.Parent = Parent

		-- / Properties / --
		Block.Name = Position.X..", "..Position.Z
		Block.Anchored = true
		Block.Size = Size
		Block.Position = Position

		-- / Visuals / --
		
		if Block.Position.Y <= -1 then
			Block.Color = Color3.fromRGB(255, 220, 114)
			Block.Material = Enum.Material.Sand
			
		elseif Block.Position.Y > -1 and Block.Position.Y <= 1.25 then
			Block.Color = Color3.fromRGB(100, 100, 100)
			Block.Material = Enum.Material.Rock
			
		else
			Block.Color = Color3.fromRGB(0, 85, 0)
			Block.Material = Enum.Material.Grass
			
		end
	end
	---game.Workspace.Terrain:FillBlock(CFrame.new(Position), Size, Enum.Material.Grass)

end

local function CreateNewChunk(ChunkPositionX, ChunkPositionZ)
	if not Chunks:FindFirstChild(ChunkPositionX..", "..ChunkPositionZ) then
		print(ChunkPositionX..", "..ChunkPositionZ)
		
		local NewChunk = Instance.new("StringValue")
		NewChunk.Parent = Chunks
		
		NewChunk.Name = ChunkPositionX..", "..ChunkPositionZ
		
		local Water = game.Workspace.Terrain:FillBlock(CFrame.new(ChunkPositionX, -10, ChunkPositionZ), Vector3.new(Configuration.ChunkSize.Value, 16, Configuration.ChunkSize.Value), Enum.Material.Water)
		
		for iX = ChunkPositionX + (Configuration.ChunkSize.Value / 2), (ChunkPositionX - (Configuration.ChunkSize.Value / 2)) + 4, -Configuration.Grid.Value do
			for iZ = ChunkPositionZ + (Configuration.ChunkSize.Value / 2), (ChunkPositionZ - (Configuration.ChunkSize.Value / 2)) + 4, -Configuration.Grid.Value do
				local GridY = CreateNoise(iX, iZ)

				CreateNewGrass(Configuration.GrassSize.Value, Vector3.new(iX, GridY, iZ), NewChunk)

			end

			task.wait()
		end
	end
end

if not Chunks:FindFirstChild("0, 0") then
	CreateNewChunk(0, 0)
	
end
