Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why In Roblox Studio, why does it underline 1stPlayers it with red?

Hi, So I am trying to make a fighting simulator, and for some reason, it underlines this word = 1stPlayer , you can see it and here is my script:

           function sayhello()
               print("hi there")
           end
           
           -- complexed function to shut down server
          function EndServer() 
             
             --get list of all players 
             **1stPlayer** = game.Players:GetChildren
     
              --loop through our list of players and kick each of them out.
            for _ , i in pairs(1stPlayers)  do
               i:kick("The server is shutting down")
            end
          end
 
          sayhello()
          wait(5)
          EndServer()

1 answer

✓ Accepted answer

The reason it's underlined in red is because you put a number before letters. Here's how it should look

 function sayhello()
     print("hi there")
 end

 -- complexed function to shut down server
function EndServer() 

   --get list of all players 
   Player1st = game.Players:GetChildren

    --loop through our list of players and kick each of them out.
  for _ , i in pairs(1stPlayers)  do
     i:kick("The server is shutting down")
  end
end

sayhello()
wait(5)
EndServer()

Pretty sure it'll work

This discussion is preserved as it was. New answers, comments, and votes are closed.