# Channels

Channels are cool, but sometimes confusing to set up. This module also simplifies that (somewhat)

{% hint style="info" %}
The default chat channel if you need it for some reason with the ':getChannel' method is 'All'.
{% endhint %}

### :createChannel

This method ***creates*** a chat channel object, more on those below.

#### Arguments:

\<string> name -> Chat channel name

**Sample code:**

```lua
-- This creates a VIP channel and assigns everyone to it
-- (planning on adding the AutoJoin property later chat nerds lol)

local channel = chatPlus:createChannel("VIP")
channel:setWelcomeMessage("Only vip people can see this!")

chatPlus:onPlayer(function(player)
    channel:assignUser(player)
end)
```

Result:

{% hint style="info" %}
In order to show the channels bar like below, check out the 'setConfig' method in the 'Misc. functions' category of the documentation.
{% endhint %}

![](https://4256898209-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmN4RyN9FVWeA5lfMWzJO%2Fuploads%2FGHVSy5fy0BxYs1Dz4wvf%2Fimage.png?alt=media\&token=72878b47-54dc-4f66-b432-7740b8550bc9)

Returns:

{% content-ref url="channels/channel-object" %}
[channel-object](https://jumpathy.gitbook.io/chat+-documentation/docs/channels/channel-object)
{% endcontent-ref %}

### :getChannel

This method ***gets*** a chat channel object, more on those below.

#### Arguments:

\<string> name -> Chat channel name

**Sample code:**

```lua
local channel = chatPlus:getChannel("All")
```

Returns:

{% content-ref url="channels/channel-object" %}
[channel-object](https://jumpathy.gitbook.io/chat+-documentation/docs/channels/channel-object)
{% endcontent-ref %}
