Vehicle Clone Regen Spawning / Tool Script Class-Child Searching

Currently trying to spawn in a vehicle in the way I currently have it, which is the model, and then the humanoid inside that model. However, the way the regen button has it set up so it makes a new model, then puts the old one into the new one… However, my vehicle repair tool checks the model’s children for a humanoid. The new model is called “SpeederVehicle”, so I am posting the code below from the first function it mentions the vehicle to the end of it.

	if JustRegened == false then
	JustRegened = true
	script.Parent.BrickColor = BrickColor.new("Really black")
	coroutine.resume(coroutine.create(function()
	if plr then
		if plr.Character then
			if CheckAllowed(plr) == true then
			coroutine.resume(coroutine.create(function()
			if plr.Character:findFirstChild("SpeederVehicle") ~= nil then
				plr.Character["SpeederVehicle"]:remove()
			end
			end))
			for i, v in pairs(game.Players:GetChildren()) do
				coroutine.resume(coroutine.create(function()
				if v then
					if v.Character then
						if v.Character:findFirstChild("SpeederVehicle") then
							if (v.Character["SpeederVehicle"]["Speeder"]["Engine"].Position - script.Parent.Position).magnitude <= 10 then
								v.Character["SpeederVehicle"]:remove()
							end
						end
					end
				end
				end))
				wait(0.01)
			end
			local NewCloneModel = Instance.new("Model", plr.Character)
			NewCloneModel.Name = "SpeederVehicle"
			local NewClone = Cloned:clone()
			NewClone.Parent = plr.Character
			NewClone.Parent = NewCloneModel
			NewClone["Weld"].Disabled = false
			Current = NewClone
			end
		else
			if Allowance == 2 then
				game:GetService("MarketplaceService"):PromptPurchase(plr, GamePassId)
			end
		end
	end
	end))
	wait(RegenWait)
	JustRegened = false
	script.Parent.BrickColor = OriginColor
	end
end

script.Parent["ClickDetector"].MouseClick:connect(Click)

Replying with the part of the tool’s code that checks the vehicle for a humanoid because I can’t figure out how to format two scripts in a post.

if you are trying to regenerate the part then I suggest putting the model in replicated storage and adding this script into a part:

local Model = game.ReplicatedStorage.Model

script.Parent.Touched:Conect(function()

      local Clone = Model:Clone()

     Clone.Parent = workspace

end)