Add on to Script

Hey guys, So I have a character controller script but I want to add an attack script to the overall script. Is there anything I should know before I just paste it into the end of my script? Will this even work? And if not, please tell me what modifications are needed to be made. Thanks!

Use AddComponent() method to do this.
See here.