Create infinite points

DrawFloor.Start = function(player, mouse)
	local PlayersPlot = Plots:FindFirstChild(player.Name)
	if not PlayersPlot then return end
				
	local Floor = Instance.new('Model', PlayersPlot.CameraPart)
	Floor.Name = 'Floor'
	
	local Point = CreatePoint('Point', Floor)
	
	local LowerX, UpperX, LowerZ, UpperZ = CheckBase(PlayersPlot.Base)
	
	local RenderStepped
	local Click
	
	mouse.TargetFilter = Floor
	
	RenderStepped = RunService.RenderStepped:Connect(function()
		RenderPosition(PlayersPlot, mouse.Hit.p, Point, LowerX, UpperX, LowerZ, UpperZ)
	end)
	
	Click = mouse.Button1Down:Connect(function()
		RenderStepped:Disconnect()
		Click:Disconnect()
		
		local Point = CreatePoint('Point', Floor)
		
		RenderStepped = RunService.RenderStepped:Connect(function()
			RenderPosition(PlayersPlot, mouse.Hit.p, Point, LowerX, UpperX, LowerZ, UpperZ)
		end)
		
		Click = mouse.Button1Down:Connect(function()
			RenderStepped:Disconnect()
			Click:Disconnect()
			
			local Point = CreatePoint('Point', Floor)
			
			RenderStepped = RunService.RenderStepped:Connect(function()
				RenderPosition(PlayersPlot, mouse.Hit.p, Point, LowerX, UpperX, LowerZ, UpperZ)
			end)
			
			Click = mouse.Button1Down:Connect(function()
				RenderStepped:Disconnect()
				Click:Disconnect()
				
				local Point = CreatePoint('Point', Floor)
				
				RenderStepped = RunService.RenderStepped:Connect(function()
					RenderPosition(PlayersPlot, mouse.Hit.p, Point, LowerX, UpperX, LowerZ, UpperZ)
				end)
				
				Click = mouse.Button1Down:Connect(function()
					RenderStepped:Disconnect()
					Click:Disconnect()
					
					local Point = CreatePoint('Point', Floor)
					
					RenderStepped = RunService.RenderStepped:Connect(function()
						RenderPosition(PlayersPlot, mouse.Hit.p, Point, LowerX, UpperX, LowerZ, UpperZ)
					end)
				end)
			end)
		end)
	end)
end

Basically, evntually, I’m trying to create something that fills in an area given a set amount of ‘points’, like this


But that’s not the important part atm. What I’m currently having trouble figuring out is how to let players continue to place points, until they hit a max number, say 10?

Atm what I have is just whenever they click, it repeats the code of creating a point and said point following the mouse, but for the player to create 10 points, I’d have to have this

Click = mouse.Button1Down:Connect(function()
    RenderStepped:Disconnect()
    Click:Disconnect()
		
	local Point = CreatePoint('Point', Floor)
		
	RenderStepped = RunService.RenderStepped:Connect(function()
		RenderPosition(PlayersPlot, mouse.Hit.p, Point, LowerX, UpperX, LowerZ, UpperZ)
	end)
end)

run 10 times.

In the top example of code I have it run 5 times, which just looks really congestive

You could try creating just one event, and placing that in a numerical for loop:

local mouseClicks = --integer here
for i = 1, mouseClicks do
	Click = mouse.Button1Down:Connect(function()
		local Point = CreatePoint('Point', Floor)
	end)
	RenderStepped = RunService.RenderStepped:Connect(function()
		RenderPosition(PlayersPlot, mouse.Hit.p, --[[lazy]])
	end)
	mouse.Button1Down:Wait()
	Click:Disconnect()
	RenderStepped:Disconnect()
end

You can also make the function binded to Button1Down add to a counter, and when that counter reaches a maximum capacity, it disconnects its events:

local mouseClicks = --integer here

local counter = 0
Click = mouse.Button1Down:Connect(function()
	local Point = CreatePoint('Point', Floor)
	counter = counter + 1
	if counter >= mouseClicks then
		Click:Disconnect()
		RenderStepped:Disconnect()
	end
end)
RenderStepped = ...

Note: since I do not have full knowledge of your environment, I have no idea if this code will do what it is supposed to do.

I also have no idea how to explain how this code is different from his/hers/theirs in a logical way which is why I am spoonfeeding. I still want to help though!