WASD or arrow keys to move. 1, 2, 3 to select/hold items from your hot bar. Click while holding a block to place it. Click on a block while holding nothing to break it. Click the number key of the item you are already holding to unselect it.
Collision detection script from Griffpatch, but feel free to use your own.