Restricting Axis Movement!!?!?

This might be an easy question to some people, but not for me :cry:

I want to create an object where the user can drag it only on the x and y axis. The z axis should stay put and not move at all. How would I add restrictions to only x and y?

And any tips for making my lines of codes more professional looking?

196933–7154–$mycode_101.js (117 Bytes)

Put this in Update():
rigidbody.velocity.z = 0;
transform.position.z = 0;

You’re done!