Only Player Join [ Need Help Pls ]

Hello you can help for make a system for when a player joins his kick unless his nickname is in the script for example if the person is not called test he cannot come and is kick [ Sorry i am bad in english ]

local ExemptPlayers = {"Name", "Name"} --Change to the player's which will be exempt from being kicked

game.Players.PlayerAdded:Connect(function(plr)
	if table.find(ExemptPlayers, plr.Name) then
		print("Allowing players to enter")
	else
		plr:Kick("Not whitelisted.")
	end
end)

However, it is advised you use UserIds in case that specific player changes their username.

4 Likes
local whitelistUserIDs = {}

game.Players.PlayedAdded:Connect(function(player)
    if not table.find(whitelistUserIDs,player.UserId) then --If the UserID value is not in the table this returns nil. In Lua nil equals false.
        player:Kick("You are not whitelisted on this server.")
    end
end)

at

local whitelistUserIDs = {}

add the ID

example:

local whitelistUserIDs = {1810583117}