Universal Script 📌
781 Views
147 Executions

Leave When Someone Joins

Universal Script 📌
etherheaded
etherheadedFirst script
9 months ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

You can choose to automatically leave the game if players are currently detected in your server, or if players join leater.

View Raw
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)
end


Comments

5
Log in to join the conversation. Login
Luvv's profile picture
Luvv7 months ago

this is actually helpful when i auto farm on dead games that dont have private servers allowed so just incase

2
zivoria's profile picture
zivoria9 months ago

1. AI 2. What on earth could this be used for.

2
gayasf's profile picture
gayasf9 months ago

@Astric its useful incase you want to be lonely

1
Nothing_sam's profile picture
Nothing_sam9 months ago

@gayasf lol

1
skidsense's profile picture
skidsense9 months ago

@gayasf just (esc + enter) and its done without scripts this is obviously made by chatgpt and is useless

1

More universal scripts

See all
Universal Script 📌
28.3k
663.4k
Bumped 36 minutes ago
Script hub
13.5k
2.7k
Bumped 3 hours ago
Key System
Paid
Script hub
263.1k
88.1k
Bumped 4 hours ago
Key System
Universal Script 📌
2.4k
9.4k
Bumped 4 hours ago
Universal Script 📌
224
30
Approved 4 hours ago
Universal Script 📌
249
26
Approved 4 hours ago
Universal Script 📌
272
9
Approved 4 hours ago