|
| 01 Nov 2016 12:04 PM |
| Hi, I have made a script that is in StarterPlayer.StarterCharacterScripts and im trying to make a script that bans people. This removes every character from the game: "script.Parent:Remove()" I would like to make the script search for a player (Example: Bad_guy) and insert this script: "script.Parent:Remove()" into the character. |
|
|
| Report Abuse |
|
|
| 01 Nov 2016 12:25 PM |
if script.Parent.Name == "Bad_guy" then script.Parent:Destroy() end
Just a heads up- remove() is not reliable, especially when removing a character from the game. Also, if you want a character to not join the game, the method you're taking is not reliable.
If you want a more reliable method, try this. It goes in ServerScriptService as a normal script:
local bannedUsers = {"Bad_guy","Bad_guy2"} -- Add as many as you like
function getBanned(name) for i,v in pairs(bannedUsers) do if v == name then return true end end end
game.Players.PlayerAdded:connect(function(p) if getBanned(p.Name) then p:Kick("Optional message here") end end)
|
|
|
| Report Abuse |
|
| |