Index: /code/trunk/src/modules/objects/Script.cc
===================================================================
--- /code/trunk/src/modules/objects/Script.cc	(revision 7482)
+++ /code/trunk/src/modules/objects/Script.cc	(revision 7483)
@@ -55,6 +55,4 @@
     /*static*/ const int Script::INF = -1;
 
-    /*static*/ LuaState* Script::LUA_STATE = NULL;
-
     /**
     @brief
@@ -185,5 +183,4 @@
     void Script::execute(unsigned int clientId, bool fromCallback)
     {
-        COUT(0) << "EXECUTE: " << Host::getPlayerID() << " | " << clientId << std::endl; //TODO: Remove.
         // If this is the server or we're in standalone mode we check whether we still want to execute the code and if so decrease the number of remaining executions.
         if(GameMode::isServer() || GameMode::isStandalone())
@@ -192,9 +189,4 @@
             if(this->times_ != Script::INF && this->remainingExecutions_ == 0)
                 return;
-
-            // Decrement the number of remaining executions.
-            //TODO: Mode such that this is consistent in any case.
-            if(this->times_ != Script::INF)
-                this->remainingExecutions_--;
         }
 
@@ -208,5 +200,4 @@
         if(!GameMode::isStandalone() && GameMode::isServer() && Host::getPlayerID() != clientId)
         {
-            COUT(0) << "1" << std::endl; //TODO: Remove.
             // If this is not the result of a clientConnected callback and we want to execute the code for all clients.
             //TODO: In this case does the server get executed as well?
@@ -217,4 +208,6 @@
                 {
                     callStaticNetworkFunction(Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());
+                    if(this->times_ != Script::INF) // Decrement the number of remaining executions.
+                        this->remainingExecutions_--;
                 }
             }
@@ -222,6 +215,7 @@
             else
             {
-                COUT(0) << "2" << std::endl; //TODO: Remove.
                 callStaticNetworkFunction(Script::executeHelper, clientId, this->getCode(), this->getMode(), this->getNeedsGraphics());
+                if(this->times_ != Script::INF) // Decrement the number of remaining executions.
+                    this->remainingExecutions_--;
             }
         }
@@ -234,6 +228,4 @@
     /*static*/ void Script::executeHelper(const std::string& code, const std::string& mode, bool needsGraphics)
     {
-        COUT(0) << "HELPER: " << code << " | " << mode << " | " << needsGraphics << std::endl; //TODO: Remove.
-
         // If the code needs graphics to be executed but the GameMode doesn't show graphics the code isn't executed.
         if(needsGraphics && !GameMode::showsGraphics())
@@ -244,7 +236,7 @@
         else if(mode == Script::LUA) // If it's 'lua'.
         {
-            if(Script::LUA_STATE == NULL)
-                Script::LUA_STATE = new LuaState();
-            Script::LUA_STATE->doString(code);
+            LuaState* luaState = new LuaState();
+            luaState->doString(code);
+            delete luaState;
         }
     }
@@ -261,6 +253,5 @@
         if(!GameMode::isStandalone() && GameMode::isServer() && this->isOnLoad())
         {
-            if(clientId != 0) //TODO: Remove if not needed.
-                this->execute(clientId, true);
+            this->execute(clientId, true);
         }
     }
Index: /code/trunk/src/modules/objects/Script.h
===================================================================
--- /code/trunk/src/modules/objects/Script.h	(revision 7482)
+++ /code/trunk/src/modules/objects/Script.h	(revision 7483)
@@ -176,5 +176,4 @@
             bool forAll_; //!< Whether the code is executed for all players (in a multiplayer setup) or just for the one triggering the Script.
 
-            static LuaState* LUA_STATE; //!< The LuaState to execute the code in lua.
             int remainingExecutions_; //!< The number of remainign executions. -1 denotes infinity.
 
