Scope scripting

How can I implement a scope feature to my gun ?