What's wrong with my VIP Chat Tag script?

I’m attempting to create a VIP chat tag script. However, I’m experiencing an error:

- SpeakerAdded is not a valid member of ModuleScript "ServerScriptService.ChatServiceRunner.ChatService"

I’ve gone as far as copying and pasting source code from tutorial videos and am still running into this issue with SpeakerAdded. Is there something obvious I’m missing in my code?

wait(5)

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

CHAT_SERVICE.SpeakerAdded:Connect(function(PLAYER_NAME)
	wait(5)
	local PLAYER = game.Players:FindFirstChild(PLAYER_NAME)
	if PLAYER then
		if PLAYER.modstats.Gold.Value == true then
			local SPEAKER = CHAT_SERVICE:GetSpeaker(PLAYER_NAME)
			SPEAKER:SetEatraData("ChatColor", Color3.fromRGB(239, 184, 56))
			SPEAKER:SetExtraData("Tags", {{
				TagText = "GOLD",
				TagColor = Color3.fromRGB(239, 184, 56) 
			}})
		end
	end
end)

Help appreciated and happy developing! :hidere:

2 Likes

Unfortunately it looks like that results in an error as well.

-   'ChatService' is not a valid Service name

Thanks for the suggestion, though!

1 Like

@BeastyBlake101

Attempt 1
--// Script
game.Players.PlayerAdded:Connect(function(player)
	if player:WaitForChild("modstats").Gold.Value == true then
		local tags = {
			{
				TagText = "GOLD",
				TagColor = Color3.fromRGB(239,184,56) --vip color
			}
		}
		local ChatService = require(game:GetService("ServerScriptService"):WaitForChild('ChatServiceRunner').ChatService)
		local speaker = nil
		while speaker == nil do
			speaker = ChatService:GetSpeaker(player.Name)
			if speaker ~= nil then break end
			wait(0.01)
		end
		speaker:SetExtraData("Tags",tags)
		speaker:SetExtraData("ChatColor",Color3.fromRGB(239,184,56)) --text color
	end
end)
--// Script Ending

Attempt 2
wait(5)

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

CHAT_SERVICE.SpeakerAdded:Connect(function(PLAYER_NAME)
	wait(5)
	local PLAYER = game.Players[PLAYER_NAME]
	if PLAYER ~= nil then
		if PLAYER:WaitForChild("modstats").Gold.Value == true then
			local SPEAKER = CHAT_SERVICE:GetSpeaker(PLAYER_NAME)
			SPEAKER:SetEatraData("ChatColor", Color3.fromRGB(239, 184, 56))
			SPEAKER:SetExtraData("Tags", {{
				TagText = "GOLD",
				TagColor = Color3.fromRGB(239, 184, 56) 
			}})
		end
	end
end)

the client can’t get ServerScriptService

@BeastyBlake101

You forgot to add require()

Using :WaitForChild() in PLAYER is also recommeneded.

local CHAT_SERVICE = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))
if PLAYER:WaitForChild("modstats").Gold.Value == true then
2 Likes

Also,
image
I think you meant ExtraData.

Maybe use require here?

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

instead of

You didn’t require the ChatService. :confused: