Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I add chat tags?

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

✓ Accepted answer

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"

1 comment

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"

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)

1 comment

0

Thanks!

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"

2 comments

1

Imagine copy and pasting answer

0

Imagine copy and pasting answer

This discussion is preserved as it was. New answers, comments, and votes are closed.