Run it
Copy the script and paste it into your executor.
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
-- Toggles
local kickIfAlreadyInServer = true -- kicks if someone is already in server
local kickOnPlayerJoin = true -- kicks if someone joins later
if kickIfAlreadyInServer then
for _, player in ipairs(Players:GetPlayers()) do
if player ~= localPlayer then
localPlayer:Kick("Another player is already in the server.")
return
end
end
end
if kickOnPlayerJoin then
Players.PlayerAdded:Connect(function(player)
if player ~= localPlayer then
localPlayer:Kick("Another player joined the server.")
end
end)
endYou can choose to automatically leave the game if players are currently detected in your server, or if players join leater.

Universal