I wanted to make a developer chat tag for myself with the new chat service, but I tried and got an error. It was “attempt to index nil with UserId” and when I chat, it warned me “Error occurred while calling TextChatService.OnIncomingMessage: Error occurred while calling TextChatService.OnIncomingMessage: TextColor3 is not a valid member of TextChatMessage Instance”. I have no idea what is going on and how to fix it, so help = appreciated. Also here’s my script:
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local developerUserIDs = {4211919501} -- My User ID
local function isDeveloper(player)
return table.find(developerUserIDs, player.UserId) ~= nil
end
local function onMessageReceived(textChatMessage)
local player = Players:GetPlayerByUserId(textChatMessage.TextSource.UserId)
if player and isDeveloper(player) then
local hammerIcon = "🔨"
textChatMessage.PrefixText = hammerIcon .. " [Developer] " .. player.DisplayName
textChatMessage.TextColor3 = Color3.fromRGB(255, 0, 0)
end
return textChatMessage
end
TextChatService.OnIncomingMessage = onMessageReceived