diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index 4af5066aeb8df5a75b6091c205e932c72f6f2349..1d183cdec6b6a518f38ed32725ed5f19ec4a45cd 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -3544,7 +3544,7 @@ static int lib_gAddGametype(lua_State *L)
 // Partly lifted from Got_AddPlayer
 static int lib_gAddPlayer(lua_State *L)
 {
-	INT16 i, newplayernum, botcount = 1;
+	INT16 i, newplayernum;
 	player_t *newplayer;
 	SINT8 skinnum = 0, bot;
 
@@ -3552,10 +3552,8 @@ static int lib_gAddPlayer(lua_State *L)
 	{
 		if (!playeringame[i])
 			break;
-
-		if (players[i].bot)
-			botcount++; // How many of us are there already?
 	}
+
 	if (i >= MAXPLAYERS)
 	{
 		lua_pushnil(L);