When I make admins scripts, I start them like this but it doesn't work right. If I were to add an FF command and say it, it would give everyone a FF in the server. Even If I say something like ff/Jacobrw01. I don't know why. Here is how I start though;
01 | local admins = { |
02 | [ "Jacobrw01" ] = true ; |
03 | [ "nws18" ] = true ; |
04 | [ "JEFFREY0770" ] = true ; |
05 | } |
06 |
07 | game.Players.PlayerAdded:connect( function (plr) |
08 | if admins [ plr.Name ] then |
09 | plr.Chatted:connect( function (m) |
10 | if m:sub( 1 , 5 ) = = "kill/" then |
11 | m:sub( 1 , 6 ) |
12 | for i,v in pairs (game.Players:GetChildren()) do |
13 | v.Character:BreakJoints() |
14 | end |
15 | end |
16 | end ) |
17 | end |
18 | end ) |
This is roughly how I set it up on all my commands.
01 | local admins = { |
02 | [ "Jacobrw01" ] = true ; |
03 | [ "nws18" ] = true ; |
04 | [ "JEFFREY0770" ] = true ; |
05 | } |
06 |
07 | local function findPlayer(msg,findName) |
08 | local seperate = msg:lower():sub(findName) |
09 | for a,b in pairs (game.Players:GetPlayers()) do |
10 | if string.find(b.Name:lower(), seperate) then |
11 | return b |
12 | end |
13 | end |
14 | return false |
15 | end |