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 System

Previous Thread :: Next Thread 
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:37 AM
I am working on a script where if you do ;ban (PlayerName) it would kick and add the playername to a folder called "BannedPlayers" so whenever when a player joins "PlayerAdded" it would look through it, the issue is I think i'm using GetChildren() wrong and I don't understand how I did it wrong. Here's the script...
game.Players.PlayerAdded:connect(function(plr)
print("It ran")
if plr.Name == script.Parent:GetChildren().Name then
print("he banned..")
end
end)
Report Abuse
HardTyranny is not online. HardTyranny
Joined: 28 Aug 2014
Total Posts: 121
02 Jul 2016 09:41 AM
game.Players.PlayerAdded:connect(function(plr)
if plr.Name == "aName" then
plr:Kick()
end
end)


Waffles are good for you.
Report Abuse
doggy00 is online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
02 Jul 2016 09:42 AM
y'know there are hundreds- no, thousands of free models out there that do this.

i respect you for not using them, even i'm using scripth server suite over here, but i'm about to make my own commands because his keeps lagging and such.

as for the script, nonono, GetChildren() is used to get ALL of the children. If you're looking for a single child, use :FindFirstChild, it works the same for the most part. Unless I'm missing something huge here (which is likely because i'm really sleepy and stuff), this SHOULD work.

if plr.Name == script.Parent:FindFirstChild("Name") then


what should be siggy be?
Report Abuse
doggy00 is online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
02 Jul 2016 09:42 AM
Alternatively hard's way works too, didn't know :Kick() was a thing, I'll have to toy with that.


what should be siggy be?
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:51 AM
Btw, I forgot to mention whenever a player is added to the ban list the name is added to a number value and the name of it is replaced with the players name.
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:53 AM
I realized, doggy I am also making admin commands. I got like 8 commands done so far I can't believe it takes up 200+ lines.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 09:53 AM
local Admins = {warspyking = true, MysticKey = true}

game.Players.PlayerAdded:connect(function(p)
if Admins[p] then
p.Chatted:connect(function(c)
if c:sub(1, 6) == ';kick ' then
for i,v in next, game.Players:GetPlayers() do
if v:lower():sub(1, #c-6) == c:lower():sub(7) then
v:Kick()
break
end
end
end
end)
end
end)


Should do the trick.
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:53 AM
plus doggy what you can do with kick is add a message like this game.Players.NAME:Kick("Lol u r kicked m8")
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 09:54 AM
local Admins = {warspyking = true, MysticKey = true}

game.Players.PlayerAdded:connect(function(p)
if Admins[p] then
p.Chatted:connect(function(c)
if c:sub(1, 6) == ';kick ' then
for i,v in next, game.Players:GetPlayers() do
if v.Name:lower():sub(1, #c-6) == c:lower():sub(7) then
v:Kick()
break
end
end
end
end)
end
end)


Sorry, made a small mistake
Report Abuse
Altaccount135 is not online. Altaccount135
Joined: 02 May 2016
Total Posts: 83
02 Jul 2016 09:55 AM
It isn't as easy as you think. I would use Trello and HTTPservice to keep track of banned players without updating the game.


--killerbot29003's alt
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:56 AM
I got the command done, I just need where it would look through a folder finding a name that matches. Not a entire command it's self.
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
02 Jul 2016 09:57 AM
local Admins = {warspyking = true, MysticKey = true}

game.Players.PlayerAdded:connect(function(p)
if Admins[p] then
p.Chatted:connect(function(c)
if c:sub(1, 6) == ';kick ' then
local pName = c:sub(7)
if game.Players:FindFirstChild(pName) then
game.Players[pName]:Kick()
end
end
end)
end
end)

Mine > warspykings
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:57 AM
Well, I want to use a folder that keeps track of banned players.
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 09:58 AM
MyDefault that only kicks them... I need a ban one. I need to figure out how to make it when a player joins "PlayerAdded" the script looks through the folder trying to find a matching name if it does then it kicks them. I just need the finding part. Not a entire command.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 09:58 AM
@ByDefault Nope mind is much better. Mine allows you to shorten names, e.g.

;kick By

instead of

;kick ByDefault
Report Abuse
Color3new is not online. Color3new
Joined: 05 Jul 2009
Total Posts: 64
02 Jul 2016 09:59 AM
Using a folder won't allow you to save bans. It'll be empty as soon as a new server is created.

Use DataStorage.

http://wiki.roblox.com/index.php?title=Saving_Player_Data
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 10:03 AM
local DS = game:GetServices("DataStoreService"):GetDataStore("AdminStuff")

local Admins = DS:GetAsync("Admins")
local Banned = DS:GetAsync("Banned") or {}
if not Admins then
local default = {warspyking = true, MysticKey = true}
DS:SetAsync("Admins", default)
Admins = default
end

game.Players.PlayerAdded:connect(function(p)
if Banned[p.Name] then
p:Kick()
elseif Admins[p.Name] then
p.Chatted:connect(function(c)
if c:sub(1, 5) == ';ban ' then
for i,v in next, game.Players:GetPlayers() do
if v.Name:lower():sub(1, #c-5) == c:lower():sub(6) then
Banned[v.Name] = true
DS:SetAsync("Banned", Banned)
v:Kick()
break
end
end
end
end)
end
end)




Try that?
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 10:03 AM
That's the point... I am actually workin on two different commands "{sban (Name)" server ban.. "{gban (name)" game ban.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 10:07 AM
local Admins = DS:GetAsync("Admins")
local Banned = DS:GetAsync("Banned") or {}
local TempBanned = {}
if not Admins then
local default = {warspyking = true, MysticKey = true}
DS:SetAsync("Admins", default)
Admins = default
end

game.Players.PlayerAdded:connect(function(p)
if Banned[p.Name] or TempBanned[p.Name] then
p:Kick()
elseif Admins[p.Name] then
p.Chatted:connect(function(c)
if c:sub(1, 6) == ';gban ' then
for i,v in next, game.Players:GetPlayers() do
if v.Name:lower():sub(1, #c-6) == c:lower():sub(7) then
Banned[v.Name] = true
DS:SetAsync("Banned", Banned)
v:Kick()
break
end
end
elseif c:sub(1, 6) == ';sban ' then
for i,v in next, game.Players:GetPlayers() do
if v.Name:lower():sub(1, #c-6) == c:lower():sub(7) then
TempBanned[v.Name] = true
v:Kick()
break
end
end
end
end)
end
end)




Does that one fit your needs?
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 10:12 AM
Yes thank you, but what about an unban?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 10:13 AM
I gave you all the logic you'd need to make an unban. I'm not writing your entire admin, that defeats the purpose of writing one yourself. Just use a freemodel if you're not going to try.
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 10:18 AM
No, i'm not specialized in bans and unbans but I can do everything else myself.
Report Abuse
MysticKey is not online. MysticKey
Joined: 28 May 2016
Total Posts: 139
02 Jul 2016 10:19 AM
Btw, I don't think you defined "DS" so the script isn't working.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 10:20 AM
'specialized'


There's no such thing as being 'specialized'. All it is is using kick if they're in a table. It's not hard to modify my current commands to just remove them instead of adding.



Besides, you clearly can't do 'everything else', you posted a question earlier and you didn't know how to use string.lower...
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 10:21 AM
local DS = game:GetServices("DataStoreService"):GetDataStore("AdminStuff")

Just put that at the top *shakes head to show depression*
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