I need help people i don't want are coming to my games. -_-
Here, this is a script I made which I use for this purpose. Also, Ziruto named the function incorrectly to match his trigger.
NoobsIHate = {"name";"othernoob"} function NewPlayer(plr) for i, v in pairs(NoobsIHate) do if v:lower() == plr.Name:lower() then plr:Remove() end end end game.Players.PlayerAdded:connect(NewPlayer)
Okay so if you're a decent scripter, you should know about Arrays, tables and loops.
What you would want to do is set up an array:
myArray = {} -- Basic empty array
Then you want to add the people inside of the list to be banned. So know it looks like this:
bannedKiddies = {"PlayerName";"PlayerName2";"PlayerName3"} -- Array filled with strings(data)
Next you want to set up a function like so:
bannedKiddies = {"PlayerName";"PlayerName2";"PlayerName3"} -- Array function player(plr) end game.Players.PlayerAdded:connect(player)
Now you want to create a generic for loop to iterate through the table checking if the player is in the list like so:
bannedKiddies = {"PlayerName";"PlayerName2";"PlayerName3"} function onPlayerEntered(newPlayer) for i,v in pairs(bannedKiddies) do if (v:lower() == plr.Name:lower()) then plr:Kick() end end end game.Players.PlayerAdded:connect(player)
Now we have a fully operational ban script.
If it doesn't work shoot me a PM on Roblox or hopefully someone will notice my silly error.
~~Hope I helped
Well put this script in workspace.
game.Players.PlayerAdded:Connect(function(player) if player.Name == "Noob123" then print(player.Name.. " joined the game.") player:Kick end end)
All of the other ones are right, but if you're a simple scripter and you want to keep things simple, you can do this.
game.Players.PlayerAdded:connect(function(a) if a.Name == "BannedPlayerHere" then a:Kick() end end)