I have made a modcall system, but i’m wondering how I would make it so that the server saves room for moderators and no one else.
Check how many players are in the server,
For example if you have a 10 player server if the count is <=9 then
If playername is not =“Mod name” or “mod name2”
Player:kick
That’s some pseudo code of how I’d go around doing it.
If you want to make sure only certain people can join a server, you could have a whitelist and kick players who are not on it, though in this case you might want that to only turn on when a moderator is called and there will be a problem if the server is already full. Here’s an example:
local moderators = {
["Mod_Name"] = true,
["Mod_Two"] = true
}
local maxPlayers = 15 -- The maximim number of players in your server
local reservedSlots = 1
game.Player.PlayerAdded:Connect(function(plr)
-- Check if the server is full and the new player is not a moderator
if #game.Players:GetPlayers() >= maxPlayers - reservedSlots and not moderators[plr.Name] then
plr:Kick("This server is full")
end
end)
Kicking players doesn’t seem like an ideal solution as it’s possible that they’ll just end up rejoining the same server and kicked again, which could also prevent new server instances. You’re most likely better off using the server slots reserve option in the configure place page:
This would effectively be 25 players max plus friends who join, and if you’re worried that friends may take up all the slots you can just further increase the amount of server slots to reserve. With a modcall system you’re probably fetching the server jobid so I’m pretty sure it allows headroom for direct teleports.
I didn’t think that it allows people in if the server is full, but this helps anyway, I may just make it have 100 player reserves.
Say you leave 5 spaces for players though, and friends join this server there wouldn’t be a space left. I understand kicking players isn’t idea but for what the user wants its the only realistic way
Thinking about it though it’s just not an ideal thing, either way it will go wrong.
I can set a 100 player reserve.
How big is your servers though?
idk but I can make them up to 200
I’m not tryna make this an issue lol, but say a YouTuber, developer joins your game, can your game handle 200 players lol
No, it actually won’t as this is already a very niche case.
What are you trying to prove here? If you’re absolutely adamant on kicking players then incorporating one is fine with existing reserve slots or better yet you can use MessagingService to kick players while in a different server as well as being able to access moderation logs.
Thank you, I didn’t know this
was a thing, I’m definitely going to use this.