• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Globals

    Chat

    The Chat service provides functionality for creating and managing chat channels to dictate how players communicate with each other, as well as how receiving messages work in the game.

    Properties

    ChannelDestroyed

    ClientOnly
    ReadOnly

    An event that is fired by the server to all clients when a channel is destroyed. Class.ChannelInfo is passed as the parameter.

    Chat.ChannelDestroyed:Connect(function(channel)
      print("Channel " .. channel.name .. " has been destroyed.")
    end)
    

    PlayerJoinedChannel

    ClientOnly
    ReadOnly

    PlayerLeftChannel

    ClientOnly
    ReadOnly

    An event that is fired by the server to all clients in the same channel as the player that left. Class.ChannelInfo and Class.Player are passed as the parameters.

    Chat.PlayerLeftChannel:Connect(function(channel, player)
      print(player.name .. " has left the channel.")
    end)
    

    TextMessageReceivedHandler

    ClientAndServer
    ReadOnly

    An event that is fired when a client receives a text message. If this event has no connected listeners, the text message will display normally. If you connect to this event to do custom messaging logic, use the DisplayTextMessage method to send the final results. Class.ChannelInfo, Class.Player (the sender), and string are passed as the parameters.

    Chat.TextMessageReceivedHandler:Connect(function(channel, player, message)
      Chat:DisplayTextMessage(channel, player, message)
    end)
    

    activeChannel

    ClientOnly
    ReadOnly

    The chat channel the local player is currently active in

    allChannels

    ClientAndServer
    ReadOnly

    All chat channels that exist in the game.

    joinedChannels

    ClientOnly
    ReadOnly

    overrideChatBubbleSound

    boolean
    ClientOnly

    slowModeEnabled

    boolean
    ClientAndServer

    slowModeTimeout

    number
    ClientAndServer

    Methods

    Adds the given player to the given channel.

    local channel = Chat:CreateChannel("General", true, true)
    
    server.PlayerConnected:Connect(function(player)
      Chat:AddPlayerToChannel(channel, player)
    end)
    

    Parameters

    channelInfo
    player

    Returns

    void

    CreateChannel

    ServerOnly

    Creates a new channel. If the channel already exists, it will return the existing channel.

    local isGameRunning = true
    
    local ghostChannel = Chat:CreateChannel("Ghost", true, false)
    local generalChannel = Chat:CreateChannel("General", true, true)
    
    server.PlayerConnected:Connect(function(player)
      if isGameRunning then
        Chat:AddPlayerToChannel(generalChannel, player) -- General channel is for players who are in the game
      else
        Chat:AddPlayerToChannel(ghostChannel, player) -- Ghost channel is for players who are not in the game
      end
    end)
    

    Parameters

    channelName
    string
    allowsText
    boolean
    allowsVoice
    boolean
    priority
    number
    optional

    DestroyChannel

    ServerOnly

    Destroys the given channel, removing all players from it.

    local generalChannel = Chat:CreateChannel("General", true, true)
    
    server.PlayerConnected:Connect(function(player)
      Chat:AddPlayerToChannel(generalChannel, player)
    end)
    
    server.PlayerDisconnected:Connect(function(player)
      Chat:RemovePlayerFromChannel(generalChannel, player)
    end)
    
    server.PlayerLeft:Connect(function(player)
      Chat:DestroyChannel(generalChannel)
    end)
    

    Parameters

    channelInfo

    Returns

    void

    Spawns a chat bubble at the given position with the given message and an optional nametag. The chat bubble will have the same appearance and lifespan as a normal player chat message.

    Parameters

    position
    message
    string
    name
    string
    backgroundColor
    fontColor

    Returns

    void

    Spawns a chat bubble at the given position with the given message and an optional nametag. The chat bubble will have the same appearance and lifespan as a normal player chat message.

    Parameters

    position
    message
    string
    name
    string
    backgroundColor
    fontColor
    overrideChatBubbleSound
    boolean
    chatBubbleSound
    optional

    Returns

    void

    Spawns a chat bubble at the given position with the given message and an optional nametag. The chat bubble will have the same appearance and lifespan as a normal player chat message.

    Parameters

    position
    message
    string
    name
    string
    overrideChatBubbleSound
    boolean
    chatBubbleSound
    optional

    Returns

    void

    Spawns a chat bubble at the given position with the given message and an optional nametag. The chat bubble will have the same appearance and lifespan as a normal player chat message.

    Parameters

    position
    message
    string
    name
    string
    optional

    Returns

    void

    Parameters

    from
    message
    string
    language
    string
    backgroundColor
    fontColor

    Returns

    void

    Parameters

    from
    message
    string
    language
    string
    backgroundColor
    fontColor
    overrideChatBubbleSound
    boolean
    chatBubbleSound
    optional

    Returns

    void

    Parameters

    from
    message
    string
    language
    string
    overrideChatBubbleSound
    boolean
    chatBubbleSound
    optional

    Returns

    void

    Parameters

    from
    message
    string
    language
    string
    optional

    Returns

    void

    GetChannel

    ClientAndServer

    Gets the chat channel with the given name

    Parameters

    channelName
    string

    ReapplyFilters

    ServerOnly

    Parameters

    player

    Returns

    void

    Removes the given player from the given channel.

    Parameters

    channelInfo
    player

    Returns

    void

    Parameters

    channelInfo
    player

    Returns

    void

    Updated 4 days ago

    PocketWorlds Icon

    © 2025 Pocket Worlds. All rights reserved.