Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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

Log in to vote
1
Answered by 4 years ago

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

Ad

Answer this question