Smart model cloning

I want to do a smart clone of the model (my boat). Here’s how my cloning works I go to the NPC and I get a window with the choice of spawn boats.

I have the code,but it doesn’t work the way I need. I have a script that looks for a model in the region, and if there is no model, when I click on the button, my model (boat) will spawn, but there is an error, because even when there is a boat, it still clones it, although as I said, I made a script that looks for a model, and only when it does not find it will spawn. Does anyone know what the problem is?

I tried to create a variable that determines when the boat is in the region, but it doesn’t help, or I did something wrong.

My script are server.

local ServerStorage = game:GetService("ServerStorage")
local Boat1 = ServerStorage:FindFirstChild("Boat1")
local Button = script.Parent
local Main = Button.Parent
local WhiteRegionCheck = game.Workspace:WaitForChild("WhiteRegionCheck")
local Position1 = WhiteRegionCheck.Position - (WhiteRegionCheck.Size / 2)
local Position2 = WhiteRegionCheck.Position + (WhiteRegionCheck.Size / 2)
local Region = Region3.new(Position1, Position2)
	
Button.MouseButton1Down:Connect(function(Click)
	local PartsInRegion = workspace:FindPartsInRegion3(Region, nil, 1000)
	for i, Parts in pairs(PartsInRegion) do
		wait(1)
		if not Parts.Parent:FindFirstChild("Boat1") then
			local CloneBoat1 = Boat1:Clone()
			print("Cloned")
			CloneBoat1.Parent = game.Workspace
			Main.Visible = false
			break
		end
	end
end)

To make this easier why not just have a designated folder in the workspace for holding the boat models and then just iterate over the children of the folder and check if the boat is there?

Can you explain this to me in more detail? I don’t really understand how to do this. I will create a folder with boats, and then what? how do I make sure that if the boat sailed away from the zone, the boat disappeared from the folder?

Have some sort of invisible part in the folder and check the boat’s distance from the zone, and if its greater than a certain number then it has sailed away.

This is done with the help of magnitude? Can I find out if Magnitude works in all directions starting from the Central part zone, right?

Can you explain that question a little more I don’t get what your asking, Yes I do mean with the use of magnitude, but what do you mean by all directions?

Or you can check if the bounding box of the boat model is within the X and Z axis of the zone area.