How to add chat tags for the new Roblox text chat service

  1. What do you want to achieve? I want to make a chat tag for the new text chat service

  2. What is the issue? My original script does not work with the new chat service

  3. What solutions have you tried so far? Moving the chat tag script around

@be_nj

7 Likes

Hey, thanks for making a new post. Do you have a short demo file that youre working on to make this work?

Here’s a pretty basic VIP tag demo we made if that helps too:
VIPDemo.rbxl (39.9 KB)

Areas of interest:
The model in Workspace has a Touched script named VIP_GIVER that makes the Player “VIP” (really it just sets the isVIP attribute on the Player object to true. In reality you could have the attribute set when someone joins the game with VIP or purchases a game pass)

There’s a local script in StarterPlayer.StarterPlayerScripts named VIPNames that will create an OnIncomingMessage hook to add the VIP tag if the isVIP attribute is true on the TextSource’s player object.

The demo should look like this. The first message was sent before touching the VIP giver. The second message was shortly after:

10 Likes

How would I add a place to put the game pass id so that only people with the game pass have the chat tag (I’m not the best at scripting)

The easiest way to do this is to run some code when someone joins the game to check to see if the new player has purchased the game pass:

-- In a server Script under ServerScriptService
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local GAME_PASS_ID = 0 -- replace 0 with your gamepass id. see https://create.roblox.com/docs/reference/engine/classes/MarketplaceService#UserOwnsGamePassAsync for more info
Players.PlayerAdded:Connect(function(newPlayer)
    local success, ownsGamepass = pcall(function()
        return MarketplaceService:UserOwnsGamePassAsync(newPlayer.UserId, GAME_PASS_ID)
    end)

    if success then
        newPlayer:SetAttribute("isVIP", ownsGamepass)
    end
end)
3 Likes

I put the script in a script in server script service and I put my game pass id and it did not work

Did it produce an error? Could you send me the game pass ID you used? I can try to confirm its the right ID

Here is the game pass id: 29104154

1 Like

I double checked and this looks like it is working for me. Does an attribute named isVIP show up when you select your Player object? (Should be at the very bottom of the properties window)
image

2 Likes

Yes and it is checked but there is still no VIP chat tag

1 Like

Do you have a script in StarterPlayerScripts that sets the OnIncomingMessage callback? (You can ctrl+shift+F for OnIncomingMessage to search your entire studio project. if there are no results you may just need to add that!)

You can also copy and paste the LocalScript from VIPDemo.rbxl above.

1 Like

Do I just paste the script in starter player scripts?

1 Like

yup, you can just steal it as it is.

1 Like

I mean can I paste the script with the game pass id into starter player scripts to? (I added the local script from VIPDemo.rblx

1 Like

The gamepass script has to run on the server. That means it needs to be in a normal Script under ServerScriptService to run.

The LocalScript needs to be in StarterPlayerScripts to run on the local client.

1 Like

I kept it like that but it still did not work

Is there a way that I can make it so you can edit if for me?

Could you send an rbxl file of the issue? Perhaps there’s something we’re missing.

Is there a way I can make it so you can add the script in my game for me? Also my game is a Capture The Flag game and some scripts do not work in that type of game, so I wonder if this script does not work in the game

Capture The Flag.rbxl (347.2 KB) That is my game