Is there any way to add additional player slots for developers/moderators? If my game is 20 players, being able to teleport a 21st player into the server somehow? It’s a bit of a problem because when my moderators receive reports, they cannot actually join the server to investigate because it’s full.
There is the options of kicking someone with MessagingService to make room, but that’s obviously not ideal. There’s also the option of making the server 21 players and trying to teleport the 21st player to another instance but that’s also not ideal.
In my opinion, I would at least make a vote kick system, I’m pretty sure it’s impossible for you to add another slot without kicking a player. So I would just let players decide if they should be kicked, a nice democracy
Do a function that runs when a player joins the game and check the number of players in the game. Then do something like:
local players = game:GetService("Players")
local playerCount = #game.Players:GetPlayers()
players.PlayerAdded:Connect(function(player)
if playerCount >= 20 then
player:Kick("Server full :]")
end
end)
Yes, but he’s asking for a extra slot that is only reserved for mods, so if the server is full they can still join.
You could edit my script to change for that
local players = game:GetService("Players")
local playerCount = #game.Players:GetPlayers()
players.PlayerAdded:Connect(function(player)
if player.Name == "mod" or playerCount >= 20 then
player:Kick("Server full :]")
end
end)
local players = game:GetService("Players")
local playerCount = #game.Players:GetPlayers()
players.PlayerAdded:Connect(function(player)
if player.Name == "mod1" or player.Name == "mod2" or player.Name == "you" or playerCount >= 20 then
player:Kick("Server full :]")
end
end)
For multiple
Mod??? What is that supposed to do??? all thats doing is checking the players name. And all that does is kick the mod.
Edit: nvm for the mod stuff i misread, but still all it does is kick the mod
Sorry for that! I fixed it
local players = game:GetService("Players")
local playerCount = #game.Players:GetPlayers()
players.PlayerAdded:Connect(function(player)
if player.Name == "mod1" or player.Name == "mod2" or player.Name == "you" or playerCount <= 20 then
print("your in")
else
player:Kick("Server full :]")
end
end)
Uhh, I’m not sure but, I think he said that he wanted an extra slot for the mods, not just telling them if the server is full or not.
local players = game:GetService("Players")
local maxPlayers = players.MaxPlayers
local groupID = 1
local modRank = 1
players.PlayerAdded:connect(function(plr)
if #players:GetPlayers() == maxPlayers then
if plr:player:GetRoleInGroup(groupID) >= modRank then
print("Moderator slot filled")
else
plr:Kick()
end
end
end)
It still kicks them… Telling them that the server is full is because there is a message on kick. @ExercitusMortem has a better approach though.
Ok, but read the what the man wants, he wants the mods to join the game, not to be kicked
All he’s asking for is an extra slot for mods which i’m pretty sure is impossible lol
When the server is full, this’ll check if the player that last joined is a moderator. If not, kick the player. That’ll leave open a slot.
i’ve made a system like this before, basically i would set the place to have a certain amount of reserved slots (some for mods, other for the intended use of the slots), that way the slots wont fill unless a friend of someone who is already in tries to join.
as well as that, it would simply check on the added event if the maximum amount of players in the server got surpassed when the player joined, and if so it simply would check if their userid is a “moderator” (having a table somewhere that has a list) and if they are a moderator, allow them to stay. if not, then you can either kick them, or teleport them to a new server with teleport service.
when teleporting, you can set teleport data to have a message when they finally get into a new server that will let them know why they got redirected.
I changed it so that mods are not kicked. Here’s some comments:
local players = game:GetService("Players")
local playerCount = #game.Players:GetPlayers()
players.PlayerAdded:Connect(function(player)
if player.Name == "mod1" or player.Name == "mod2" or player.Name == "you" or playerCount <= 20 then --Checks if the player name is a mod or if the server is not full
print("your in")
else
player:Kick("Mod Slot Reserved") --If the player trying to join is not a mod and the server IS full, then it kicks
end
end)
Good approach, I feel like it should redirect them to another server, like how when a game doesn’t have a softshutdown, players lose engagement when the game is shutdown and they aren’t re-teleported.
Edit: I’ll edit your script to get that feel
You can set the game.Players.PreferredPlayers to game.Players.MaxPlayers - 1. That way, Roblox will automatically attempt to keep that slot open (so players don’t get filled into the server and then kicked, unless they try to join a friend).
What is NumPlayers? I don’t see it getting defined.
Oh, that’s deprecated. Use Players:GetPlayers()