Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I add chat tags?

Asked by 4 years ago

Alright, I turned bubble chat on, made it black color, and then I put script inside of ServerScriptService with the idea of making chat tags. I made the script, but it gave me error and I was wondering if it could be because of the bubble chat or is it completely different reason..Help me please.

Also, the script:

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")

local Admins = ('lmao1717')

ChatService.SpeakerAdded:Connect (function(PlrName)
    local Speaker = ChatService:GetSpeaker(PlrName)
    for _,v in pairs(Admins) do
        if Players[PlrName].Name == v then
            Speaker:SexExtraData('Tags', {{TagText = "Manager", TagColor = Color3.fromRGB(255, 255, 255)}})
        end
    end
end)

3 answers

Log in to vote
0
Answered by 4 years ago

I found 2 problems First, you need to change the "()" to "{}" to make it into a table


local Admins = {'lmao1717'}

Second

Speaker:SexExtraData('Tags', {{TagText = "Manager"

I dont think you meant to type "SexExtraData" but intead "SetExtraData"

0
I found 2 problems First, you need to change the "()" to "{}" to make it into a table view source 1 local Admins = {'lmao1717'} Second view source 1 Speaker:SexExtraData('Tags', {{TagText = "Manager" I dont think you meant to type "SexExtraData" but intead "SetExtraData" Gandhi20 4 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

The problems seems to be that your Admins value isn't a table, but a string. The for loop wont work because of this.

You can make it a table by replacing the parentheses with curly brackets.

local ServerScriptService = game:GetService("ServerScriptService")
local ChatService = require(ServerScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
local Players = game:GetService("Players")

local Admins = {'lmao1717'}

ChatService.SpeakerAdded:Connect (function(PlrName)
    local Speaker = ChatService:GetSpeaker(PlrName)
    for _,v in pairs(Admins) do
        if Players[PlrName].Name == v then
            Speaker:SexExtraData('Tags', {{TagText = "Manager", TagColor = Color3.fromRGB(255, 255, 255)}})
        end
    end
end)
0
Thanks! lmao1717 7 — 4y
Log in to vote
-1
Answered by 4 years ago

I found 2 problems First, you need to change the "()" to "{}" to make it into a table

view source

1 local Admins = {'lmao1717'} Second

view source

1 Speaker:SexExtraData('Tags', {{TagText = "Manager" I dont think you meant to type "SexExtraData" but intead "SetExtraData"

1
Imagine copy and pasting answer Azure_Kite 885 — 4y
0
Imagine copy and pasting answer 123nabilben123 499 — 4y

Answer this question