Vector3 magnitude broken?

I am trying to make a speed limit for a vehicle in my game, but using Vector3.sqrmagnitude or magnitude gives me a slowly increasing number, it doesnt matter if the vehicle is moving slowly, quickly, or not at all. What’s going on? I’m using

float speed = GetComponent<Rigidbody>().velocity.magnitude;
Debug.log(speed);

to log my speed.

Sort of an answer for anyone stumbling on this. I fixed it by putting the rigidbody into a child of the object and referencing it with GetComponentInChildren(). Not a perfect answer, but a quick fix.