How to get objects Y velocity in bge

I’m trying to make a car game in bge but I need to get the y velocity and put it into a property.
How can I do that in python?

import bge

owner = bge.logic.getCurrentController().owner

owner["SPEED"] = owner.localLinearVelocity.y

I can’t get it to work.
OK got it fixed.
I found out that you can’t use a sensor object.