There are multiple ways of doing this, but, I shall only list two, since these are commonly used (as it appears).
Many use the for loop to kick a Player from the Server, as it (to me) would look some-what like this;
for i,v in pairs(game.Players:GetPlayers()) do
v:Destroy()
end
One I do is use the PlayerAdded event to prevent a Player from joining the Server. This is how it would look like;
local slock = false;
function PlayerJoined(plr)
if slock and not (plr.userId == game.CreatorId or plr.Name:sub(1,6) == "Player") then
plr:Destroy()
end
end
game.Players.PlayerAdded:connect(PlayerJoined)
Either way, I recommend using both. :)
Information left out:
1. The if statement is used to check if a Condition is equal to the Argument, or if it returns true.
2. The for loop is used to, well, loop through a Table (a specific, or certain Table), as for example, creating a new table local tbl = {1,2,3};, then setting up the for loop for i,v in pairs(tbl) do print(v) end, will result in the currently Table position being iterated through (in this table) will print into the Output.
3. The GetPlayer method creates a new table of the current Children within the Players service of game (or, as .lua calls it, DataModel).
Hope this helped!