--[[local vehiclePart = vehicle.Undercarriage

local newForceField = Instance.new("Part")
newForceField.Name = "CarForceField"
newForceField.CanCollide = false
newForceField.Anchored = false
newForceField.Transparency = .5
newForceField.formFactor = "Custom"
newForceField.Size = vehicle:GetModelSize()*Vector3.new(.5, 1, .5)
newForceField.CFrame = vehicle:GetModelCFrame()
newForceField.Parent = vehicle

local newWeld = Instance.new("Weld")
newWeld.Part0 = newForceField
newWeld.Part1 = vehiclePart
newWeld.C1 = vehiclePart.CFrame:inverse() * (vehicle:GetModelCFrame() - vehicle:GetModelCFrame().p + vehiclePart.CFrame.p)
newWeld.Parent = vehiclePart
]]
--

function vAbs(vect)
	return Vector3.new(math.abs(vect.X), math.abs(vect.Y), math.abs(vect.Z))
end

function clearToRespawn(modelToRespawn)
	if modelToRespawn:IsA("Model") then
		local diag = .9*vAbs(modelToRespawn:GetModelCFrame():vectorToWorldSpace(modelToRespawn:GetModelSize()/2))
		return #game.Workspace:FindPartsInRegion3(Region3.new(modelToRespawn:GetModelCFrame().p - diag, modelToRespawn:GetModelCFrame().p + diag), nil, 100) < 1
	elseif modelToRespawn:IsA("BasePart") then
		local diag = .9*vAbs(modelToRespawn.CFrame:vectorToWorldSpace(modelToRespawn.Size/2))
		return #game.Workspace:FindPartsInRegion3(Region3.new(modelToRespawn.CFrame.p - diag, modelToRespawn.CFrame.p + diag), nil, 100) < 1
	else
		return true
	end
end

function respawnIt(toRespawn, oldParent)
	wait(timeToRespawn)

	while not (clearToRespawn(toRespawn)) do wait() end

	-- we want things with vehicle seats to NOT be welded to ground
	if not toRespawn:FindFirstChild("VehicleSeat") then
		game.JointsService:SetJoinAfterMoveInstance(toRespawn)
	end
	toRespawn.Parent = oldParent
	toRespawn:MakeJoints()
	if not toRespawn:FindFirstChild("VehicleSeat") then
		game.JointsService:CreateJoinAfterMoveJoints()
	end
end

function isSmallerThanVehicle(robloxModel)
	if robloxModel == vehicle then return false end -- check ourselves, before we wreck ourselves

	if robloxModel:IsA("BasePart") then
		return robloxModel.Size.magnitude + 4 < vehicleSize
	elseif robloxModel:IsA("Model") then
		return robloxModel:GetModelSize().magnitude + 4 < vehicleSize
	else
		return false
	end
end

function onTouch(hit, direction)