1.function serverCmdtogglestarmode(%client)
2.{
3. if(%client.mode $="1"){
4.
5. starGunProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)##{
6. if(%col.getClassName() $= "fxDTSBrick"){
7. %col.killBrick();
8. }
9. }
10.
11. starGunImage::OnMount(%this, %obj){
12. Parent::OnMount(%this);
13. %client = %obj.client;
14. if(!%client.isAdmin || !%client.isSuperAdmin){
15. %client.player.unMountImage("starGunImage");
16. }
17. }
18.
19. serverCmdstarGun(%client){
20. if(%client.isAdmin || %client.isSuperAdmin){
21. %client.player.MountImage("starGunImage",0);
22. %client.player.playThread(0,armreadyright);
23. }
24. }
25. messageAll("","\c3Star Gun is in \c0Destroy Mode");
26.}
27. if(%client.mode$ $="0") {
28. return;
29. messageAll("","\c3Star Gun is in \c0Normal Mode");
30. }
31.}
Lines 5, 11, 19: Are you defining functions here? You're already in a function!
Lines 19 and 20: You're missing a closing bracket for one of these.
Line 25: I think this is for if the client's mode is 1 (destory mode). If that's the case then it should be inside the brackets for that (in other words, switch lines 24 and 25).
Line 26: This looks like it's ending the function... in fact I think this should just be deleted.
Line 27:
%client.mode$ $= should be changed to
%client.mode $=.
Line 28:
return; will completely exit the function, but you're still calling commands on line 29. If you want the command on line 29 to be called, switch lines 28 and 29.
The best advice I can give you is to try using some kind of IDE, like Notepad++ or something that can help keep your code properly indented.
Otherwise the only thing I saw wrong was that it looked like you were defining methods inside of a function... that's a big no-no in torquescript.