generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Ban script???

Previous Thread :: Next Thread 
BlockBob12 is not online. BlockBob12
Joined: 05 Apr 2012
Total Posts: 172
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
YouFoundJojo is not online. YouFoundJojo
Joined: 02 Jun 2016
Total Posts: 120
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
BlockBob12 is not online. BlockBob12
Joined: 05 Apr 2012
Total Posts: 172
01 Nov 2016 12:33 PM
Ok thanks!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image