How i can make label 0/25 players at server (place)


I don’t really understand I’m entering the id, but I’m going to do a lot of servers, how could I make them so that the gui appears automatically through the table and if I insert the server code 1, the players will only connect there (

So change the Servers Table to this:

local Servers = {
   ["Server 1"] = {
         ["PlaceID"] = -- Enter Place ID for server 1 Note: Add a comma after each line
         ["Players"] = {}
   }
}
-- Change the TeleportServer:TeleportPartyAsync line to this v
TeleportService:Teleport(Servers[server]["PlaceID"], player)

-- Remote the placeId Variable inside of the remote event
-- and move TeleportService to the top of the script


okey, what i can do?

Let me just update the previous script and then it’s all up to you from there.

-- Server Side (script or modulescript)

local TeleportService = game:GetService("TeleportService")

local RemoteEvent = -- Path to Remote Event

local Servers = { -- Create a table for servers
   ["Server 1"] = {
      ["ID"] = 3432525, -- Place ID change those numbers to yours
      ["Players"] = {},
   }, -- You could change this to a number but you would want to store players in here I'm assuming
}

RemoteEvent.OnServerEvent:Connect(function(player : player, server : string)
   local ChosenServer = Servers[server]  

   -- Add some checks to see if a player exists in case the client is exploiting 
   -- vv basic checks please add more for safety and also a limiter for remotes
   if not ChosenServer  then return end -- Server doesn't exist
   if ChosenServer["Players"][player] then return end -- They are already in server

   table.insert(Servers[server]["Players"], player) -- Adds player to the server table 
   RemoteEvent:FireAllClient(Server, #Servers[server]) -- Update all the clients

   pcall(function() -- Not sure if this is needed but just to be safe
      TeleportService:Teleport(ChosenServer["ID"], player)
   end)
end)

This should be the server script. This should all work in theory but I highly recommend learning what everything does since it will help you debug later if needed.

Try using MessageService

Here’s a good tutorial on how to use it

Hope this helps!

1 Like


Thank you for such an effort, but the button does not work, can something need to be changed in the local script?