Roblox How to Make a Chat Commands

Posted on

Chat is like the communication feature in a lot of multiplayer games such as Roblox. There are two variations of chat: Normal Chat and Safe Chat (disabled). Both of them allow the player to chat with the other players and friends in the game. Apparently, guests were the only players who could not use the feature due to the removal of Safe Chat before they were all removed.

  1. Custom Chat

Roblox reduced the Core Scripts about the Chat Window to level 2 in the late 2016. This thing allows the creators of the game to make custom chat windows and make modifications. Though it opens the possibility for inappropriate messages to be sent, Roblox ask that creators use Chat FilterString for the system messages and anything extra, or else the game will go under review. On the brighter side, this one allows the creators of the game to make the chat window better match their games.

  1. Normal Chat

As stated before, since 2014, the Safe Chat menu is disabled, deleting the ability to chat from guests. However, every player whose age is under 13 years earns the ability to chat only with words marked on the Whitelist. Each word not marked on the Whitelist is replaced with the hashes (#). On the other hands, every player whose age is 13 years or older are able to use any word, except the ones in the Blacklist. All explicit words marked in the Blacklist were replaced by (Content Deleted). In order to avoid this kind of thing from happening, players censor their words by placing some spaces in the extreme word or even make it look like one. The thing was changed again to a hash (#).

How to make a chat commands? You want to use the Chatted event so you are able to run code when you type something. Here is the Chatted event of Player that you can use:

local function onPlayerChatted(player, message)

                if message == ‘removehead’ and player.Character and player.Character:FindFirstChild(“Head”) then

                                player.Character.Head:Destroy()

                end

end

local function onPlayerAdded(player)

                pl.Chatted:Connect(function (message) onPlayerChatted(player, message) end)

end

game.Players.PlayerAdded:Connect(onPlayerAdded)

First, the function named onPlayerAdded is linked to the PlayerAdded event. Then, the function called onPlayerChatted is linked to the Chatted event on newly-added Players. Apparently, the chatted event sends only the message to the linked function, so you can use an anonymous function to pass both player and message to onPlayerChatted. In that function, you can check if the message is removehead, and also if the head of the player exists. In the end, you need to proceed to remove the head of the speaker.

For more information about how to make a chat command, do not forget to visit the official website of Roblox. In addition, joining the forum such as DevForum is also recommended so that you are able to seek a help from the members of the forum if you have something to ask or if you need some information.

Leave a Reply

Your email address will not be published. Required fields are marked *