All Perspective scripting executes in the corresponding session on the gateway. You cannot use system.serial functions to access serial ports on the machine running the Perspective client unless you happen to be running your browser on the same machine as the gateway.
Generally, if you need access to serial ports in your clients, you need to use Vision.