Setting position of rootpart causes invisibility and weird camera angles

This is the script

		local oldRootPartPos = rootPart.Position

		rootPart:GetPropertyChangedSignal("Position"):Connect(function()
			if (rootPart.Position.Z - oldRootPartPos.Z) > humanoid.WalkSpeed/10+2 then
				if not character:FindFirstChild("TPBypass") then
					if not table.find(BypassTable, client.UserId) then
						character:SetPrimaryPartCFrame(CFrame.new(oldRootPartPos))
					end
				end
			end
			if (rootPart.Position.Y - oldRootPartPos.Y) > humanoid.JumpPower/10+3 then
				if not character:FindFirstChild("TPBypass") then
					if not table.find(BypassTable, client.UserId) then
						character:SetPrimaryPartCFrame(CFrame.new(oldRootPartPos))
					end
				end
			end
			if (rootPart.Position.X - oldRootPartPos.X) > humanoid.WalkSpeed/10+2 then
				if not character:FindFirstChild("TPBypass") then
					if not table.find(BypassTable, client.UserId) then
						character:SetPrimaryPartCFrame(CFrame.new(oldRootPartPos))
					end
				end
			end
		end)

It teleports them perfectly fine if the exploiter teleports via CFrame but it gives their character an equivalent of an irl stroke when they set their position.

At first I tried setting the cframe and that didn’t work so i changed it to the setprimarypartCFrame but it still doesn’t work.