I am trying to make a admin command script (I know ROBLOX has a ton of them) but I am wondering if it is possible to combine two tables for the script to look through at the same time? I am wanting to make a basic command such as kill and not have two chunks of a script to go through to run the command.
1 | --All but my username is made up by the way. |
2 | local Administrators = { "M39a9am3R" , "Xaphier" , "MarxTheSpot" , "Coolio" } |
3 | local Moderators = { "Crazy" , "Mod1" , "gMod" , "Lol" } |
4 | for _,v in pairs (Administrators and Moderators) do |
5 | print (v) --I made this so I could test the script to see if it will run through both tables. |
6 | end |
You have to run each loop separately, there's no way around that with how you've set up your permissions.
A solution to this is to create a combined Table for both Admins and Mods, which you can do easily, like so:
1 | local Administrators = { "M39a9am3R" , "Xaphier" , "MarxTheSpot" , "Coolio" } |
2 | local Moderators = { "Crazy" , "Mod1" , "gMod" , "Lol" } |
3 | local AdminsAndMods = { } |
4 | for _, v in pairs (Administrators) do table.insert(AdminsAndMods, v) end |
5 | for _, v in pairs (Moderators) do table.insert(AdminsAndMods, v) end |
6 |
7 | for _,v in pairs (AdminsAndMods) do |
8 | print (v) |
9 | end |