# Restricting Commands

{% hint style="danger" %}

## Important!

We just want to clarify that this is not a copy and paste codeblock tutorial. Copying things over from the codeblocks in this tutorial could result in syntax errors! Please make sure that you know what you're doing instead of skimming through and copy and pasting. Skimming through wont work well here and will result in you making tons of mistakes. Anyways, goodluck!
{% endhint %}

You will not be able to update your Custom Commands to be restricted to a certain rank, that wouldn't be ideal for the built in commands as you have to edit the Permissions module. The commands wouldn't be able to know what ranks are there, and you wont be able to edit built in commands unless you make your own MainModule which isn't supported by Pixel Administration. Instead we'll be focusing on the Permissions file like you edited earlier.

{% hint style="warning" %}
If you didn't go through the Settings tutorial, please do that. This already assumes that you already went through it. Otherwise you wont understand a word this tutorial says, or even know what to do if you don't have the proper knowledge on Pixel Administration.
{% endhint %}

With that out of the way, lets get started! Lets go to the Permissions file. In your ranks you may or may not have the following inside of a rank table:

{% code lineNumbers="true" %}

```lua
CommandAccess = "None",
```

{% endcode %}

If you don't have it, just add it to your rank. It should look like this:

{% code lineNumbers="true" %}

```lua
["YourRank"] = {
		Accent = Color3.fromRGB(122, 122, 122),
		
		...
		
		CommandAccess = "None",
}
```

{% endcode %}

{% hint style="warning" %}
"YourRank" is a placeholder for the rank you have set up. Please don't change your rank name to "YourRank" to that, but it wont matter if you do or not. Just remember that all it does is literally make your rank's name "YourRank". And I bet you already have a rank called "Admin" or "Moderator" in there.

Also the "..." represents all of the stuff in-between Accent and CommandAccess which would be your CanBan, CanKick, and all of the other permissions in there. Keep that in as well and don't just copy and paste with "...". You will get a syntax error and break your entire Permissions module.
{% endhint %}

Lets change CommandAccess to one of the following acceptable inputs:

<details>

<summary>CommandAccess: Whitelist</summary>

"Whitelist" accepts some commands, making every other command blacklisted and not usable for that rank.

{% hint style="warning" %}
Requires another key called "AllowedCommands".
{% endhint %}

The "CommandOne" and "CommandTwo" are placeholders. Just replace them with the command names. They are case sensitive with a capital letter at the beginning of each command if they're built in ("Kick", "Bring", etc.). Two is not the limit for allowed commands, you can add infinite whitelisted commands.

```lua
CommandAccess = "Whitelist"
AllowedCommands = {"CommandOne", "CommandTwo"},
```

</details>

<details>

<summary>CommandAccess: Blacklist</summary>

"Blacklist" disallows some commands, making every other command whitelisted and still usable for that rank.

{% hint style="warning" %}
Requires another key called "DisallowedCommands".
{% endhint %}

The "CommandOne" and "CommandTwo" are placeholders. Just replace them with the command names. They are case sensitive with a capital letter at the beginning of each command if they're built in ("Kick", "Bring", etc.). Two is not the limit for allowed commands, you can add infinite blacklisted commands.

```lua
CommandAccess = "Blacklist"
DisallowedCommands = {"CommandOne", "CommandTwo"},
```

</details>

<details>

<summary>CommandAccess: All</summary>

"All" accepts all commands with no restrictions. Please apply this to the ranks you trust as this gives them access to the entire command library.

```etlua
CommandAccess = "All",
```

</details>

Congratulations! You've finished this tutorial. Now you should know how to whitelist and blacklist, and even allow all commands for a rank.
