Made the script filter parts and terrain, but script doesn't follow me

I’ve made this script so everything that the player’s character touches sets the network ownership to them. I made it so it only detects part by using :IsA() but the script still detects terrain

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		for i, v in pairs(char:GetDescendants()) do
			if v:IsA("BasePart") then
				v.Touched:Connect(function(part)
					if part:IsA("BasePart") then
						if part.Parent and part.Parent:IsA("Model") then
							local partParent = part.Parent :: Model
							if partParent.PrimaryPart then
								partParent.PrimaryPart:SetNetworkOwner(plr)
							else
								part:SetNetworkOwner(plr)
							end
						end
					end
				end)
			end
		end
	end)
end)

(Edit : Also i just noticed that using :IsA() on the touched part doesn’t do anything since it already does all that)

Terrain inherits BasePart. Therefore, terrain is a basepart.
…Why do you need to do this? This code makes me uncomfortable.

i want it to detect parts, meshparts but not terrain.

Edit : Also i forgot to tell you that this code is meant to boost door physics so my game runs fluently

I guess something like this could work?

local Terrain = workspace:FindFirstChildOfClass("Terrain")

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		for _, v in pairs(char:GetDescendants()) do
			if v:IsA("BasePart") then
				v.Touched:Connect(function(part)

					if part == Terrain then return end

					if part:IsA("BasePart") then
						local parentModel = part:FindFirstAncestorOfClass("Model")
						if parentModel then
							if parentModel.PrimaryPart then
								parentModel.PrimaryPart:SetNetworkOwner(plr)
							else
								part:SetNetworkOwner(plr)
							end
						end
					end
				end)
			end
		end
	end)
end)

I hope this helps btw.

note that this script is a serverscript under serverscriptservice