Are you doing this in the Cloud9 IDE, command-line or on a web page in your browser?
The error indicates you are doing this in a browser window, which isn’t running with access to the hardware. You need to connect to the BoneScript RPC server.
Your web page must already be including bonescript.js. You still need to point to your board to make the network connection from your browser window.
Maybe this’ll make more sense...
> I ran it on the browser and I got that error. i tried on Cloud9 IDE but it kept stopping and it wasn't telling me if it actually did something.
Do you have anything hooked up to the pin to see if it is toggling?
I suspect that the pinmux mode isn't right, but I'm not sure if I don't set it up in that loop. Anyway, below is an example that probably gets a bit more usage. Note the usage of b.pinMode().