# Settings

Pixel Administration comes with a Settings module by default which is used throughout the entire system. It's required to even preform some basic tasks like permission checks. This is what the Settings module looks by default.

{% code lineNumbers="true" %}

```lua
return {
	CommandBar = {
		Keybind = Enum.KeyCode.Quote
	},
	
	Panel = {
		Keybind = Enum.KeyCode.M
	},
	
	OfflineRanks = {
		[game.CreatorId] = { Rank = "Owner", Whitelisted = true },
	}
}
```

{% endcode %}

Now see the CommandBar and Panel tables which both have Keybinds? You can change those keybinds to your liking! If you want the panel to open with the B key for example, you can simply change .M to .B after KeyCode (`Keybind = Enum.KeyCode.B`). A similar step also goes for the CommandBar as well. Also the reason why we didn't use the normal \` character for the CommandBar is because Roblox's LuaU scripting language simply doesn't support it. It'll cause syntax errors. That's why we need to set it to the name "Quote" (`Keybind = Enum.KeyCode.Quote`) to avoid any problems loading the panel.

Next lets talk about the OfflineRanks table. It's the ranks that will be handled right as soon as the panel loads instead of you having to set the ranks with commands. Now how do we actually make someone else be able to actually access the panel? Well first you'll have to do a little something like the following.

{% hint style="info" %}
Try to not remove the default "Owner" rank provided. Just add the rank below or above the "Owner" rank in the table.
{% endhint %}

{% code lineNumbers="true" %}

```lua
OfflineRanks = {
	["username"] = { -- The username to apply this ranking towards.
		Rank = "rank", -- The rank from Settings.Permissions as a string.
		Whitelisted = true -- If the user can access the panel or not.
	},
}
```

{% endcode %}

<details>

<summary>Full Example</summary>

{% code lineNumbers="true" %}

```lua
OfflineRanks = {
	[game.CreatorId] = { Rank = "Owner", Whitelisted = true },
	["username"] = { -- The username to apply this ranking towards.
		Rank = "rank", -- The rank from Settings.Permissions as a string.
		Whitelisted = true -- If the user can access the panel or not.
	},
}
```

{% endcode %}

</details>

Now we don't have any ranks yet. All we have is the default None rank inside of the Permissions module inside of Settings. Go ahead and open that up.

{% hint style="danger" %}
Don't remove the default "None" rank. It'll cause problems in some parts of Pixel Administration. Just change its values inside to your liking.&#x20;
{% endhint %}

{% code lineNumbers="true" %}

```lua
return {
	["Owner"] = {
		Accent = Color3.fromRGB(255, 85, 85),

		Notifiable = true,
		Kickable = false,
		Bannable = false,
		Warnable = false,

		CanBan = true,
		CanKick = true,
		GlobalBan = true,
		ServerBan = true,
		CanManageRanks = true,

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

		Notifiable = true,
		Kickable = true,
		Bannable = true,
		Warnable = true,

		CanBan = false,
		CanKick = false,
		GlobalBan = false,
		ServerBan = false,
		CanManageRanks = false,

		CommandAccess = "None",
	}
}
```

{% endcode %}

To fix this we just have to add our own rank by making a new table. Lets call it "Admin". Lets also give it some more advanced permissions like "CanBan", "CanKick", "GlobalBan", and "ServerBan" so they can preform those actions on other players if they'd like. Lets also prevent them from being banned too. We can do this by setting "Bannable" to false.

{% code lineNumbers="true" %}

```etlua
return {
	["Owner"] = {
		Accent = Color3.fromRGB(255, 85, 85),

		Notifiable = true,
		Kickable = false,
		Bannable = false,
		Warnable = false,

		CanBan = true,
		CanKick = true,
		GlobalBan = true,
		ServerBan = true,
		CanManageRanks = true,

		CommandAccess = "All",
	},
	["Admin"] = {
		Accent = Color3.fromRGB(122, 122, 122),

		Notifiable = true,
		Kickable = true,
		Bannable = false,
		Warnable = true,

		CanBan = true,
		CanKick = true,
		GlobalBan = true,
		ServerBan = true,
	},
	["None"] = {
		Accent = Color3.fromRGB(122, 122, 122),

		Notifiable = true,
		Kickable = true,
		Bannable = true,
		Warnable = true,

		CanBan = false,
		CanKick = false,
		GlobalBan = false,
		ServerBan = false,
		CanManageRanks = false,

		CommandAccess = "None",
	}
}
```

{% endcode %}

{% hint style="info" %}
Remember that these are just examples. You can always come back and change some other permissions for the ranks later, and even add more ranks.
{% endhint %}

Now lets add that "Admin" rank over to the Settings script again. All we have to do is assign that same "Admin" rank to that user. Don't forget to change "username" to the username of your admin! Otherwise it'll just give the player with "username" admin instead.

{% hint style="warning" %}
Display names will not work with the username. You can find a player's real username by going to their profile, and copying over the text after the @ symbol under their display name at the top.
{% endhint %}

{% code lineNumbers="true" %}

```lua
OfflineRanks = {
	[game.CreatorId] = { Rank = "Owner", Whitelisted = true },
	["username"] = { -- The username to apply this ranking towards.
		Rank = "Admin", -- The rank from Settings.Permissions as a string.
		Whitelisted = true -- If the user can access the panel or not.
	},
}
```

{% endcode %}

If you don't want to use a username, you can also use a userId number. Just change "123456789" to the userId of the user. This can be found through the user's profile at the top where the URL bar is. Just copy and paste that userId to replace "123456789". And remember! The userId is different for every user. You can't use "123456789" for everyone.

<figure><img src="https://1445404073-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuYzhZD76M7Bw9euOnkJi%2Fuploads%2FuYp9JbLDhDUENKTANKNA%2Fimage.png?alt=media&#x26;token=6a3aa520-6057-4b17-a02d-7385503847be" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}

```lua
OfflineRanks = {
	[123456789] = { -- The userId to apply this ranking towards.
		Rank = "Admin", -- The rank from Settings.Permissions as a string.
		Whitelisted = true -- If the user can access the panel or not.
	},
}
```

{% endcode %}

If you'd like to add ranks for users based on their group rank, you can configure the "Groups" table like the following. You will have to add the "Groups" table manually as it's not included by default. It's pretty similar to the normal "OfflineRanks" as you can tell. It should be pretty easy to add whitelisted group ranks, and groups if needed.

You can get the group's rank Id for each rank by utilizing the group's "Roles" tab. You can find the rank Id based on the screenshot below if needed.

<figure><picture><source srcset="https://1445404073-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuYzhZD76M7Bw9euOnkJi%2Fuploads%2FqSsJQdtm5I6zXovERyNy%2Fimage.png?alt=media&#x26;token=af16fee7-0700-4bb6-8132-5a685121d350" media="(prefers-color-scheme: dark)"><img src="https://1445404073-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuYzhZD76M7Bw9euOnkJi%2Fuploads%2FK2VM2eXRkWBmYrcCkH8a%2Fimage.png?alt=media&#x26;token=d0a3dba6-d6a9-4d79-898e-4b35279adb9e" alt=""></picture><figcaption></figcaption></figure>

```lua
Groups = {
	[123456789] = { -- The GroupId to apply this ranking towards.
		MinRank = 255, -- The minimum group rank required to receive permissions.
		Ranks = {
			[255] = { Name = "Admin", Whitelisted = true },
		}
	}
}
```

Now they're done! That player with that username should be able to see Pixel Administration's panel button at the top. To learn how to use commands, just go [here](https://systech-corp-1.gitbook.io/pixel-administration/commands). If you'd like to learn how to make custom commands, just go [here](https://systech-corp-1.gitbook.io/pixel-administration/commands/custom-commands).

{% columns %}
{% column %}

## Command Permissions

Trying to make a command restricted to just one rank you have? Or maybe even blacklisting commands for some ranks? Just get started with the button below.

<a href="../commands/restricting-commands" class="button primary">Continue Permissions</a>
{% endcolumn %}

{% column %}

## Custom Commands

If you want to learn how to make your own commands with Pixel Administration, go ahead! Just get started with the button below.

<a href="../commands/custom-commands" class="button primary">Make Commands</a>
{% endcolumn %}
{% endcolumns %}
