I have been getting a VERY specific problem when trying to migrate my game’s chat service to the new one.
I am using ROBLOX’s documentation and code examples to attempt to learn it, I did not make the preceding lines of code.
Serverside: (Works as intended)
Player:SetAttribute("NameColor", Color3.fromRGB(70, 70, 70))
Player:SetAttribute("ChatColor", Color3.fromRGB(70, 70, 70))
Player:SetAttribute("isYourTag", true)
Player:SetAttribute("isOtherTag", true)
Clientside: (Does not work as intended)
local PlayerService = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
TextChatService.OnChatWindowAdded = function(textChatMessage)
local textSource = textChatMessage.TextSource
if textSource then
local player = PlayerService:GetPlayerByUserId(textSource.UserId)
if player then
local overrideProperties = TextChatService.ChatWindowConfiguration:DeriveNewMessageProperties()
overrideProperties.PrefixText = textChatMessage.PrefixText
overrideProperties.Text = textChatMessage.Text
local nameColor = player:GetAttribute("NameColor")
if nameColor and typeof(nameColor) == "Color3" then
print(player, overrideProperties, overrideProperties.PrefixTextProperties, overrideProperties.PrefixTextProperties.TextColor3)
overrideProperties.PrefixTextProperties.TextColor3 = nameColor
end
local chatColor = player:GetAttribute("ChatColor")
if chatColor and typeof(chatColor) == "Color3" then
overrideProperties.TextColor3 = chatColor
end
local isYourTag = player:GetAttribute("isYourTag")
if isYourTag == true then
overrideProperties.PrefixText = `<font color='rgb(0, 255, 0)'>[YourTag]</font> {overrideProperties.PrefixText}`
end
local isOtherTag = player:GetAttribute("isOtherTag")
if isOtherTag == true then
overrideProperties.PrefixText = `<font color='rgb(255, 0, 0)'>[OtherTag]</font> {overrideProperties.PrefixText}`
end
return overrideProperties
end
end
return nil
end
This is the output.
Serverside, attributes are handled and are detected properly by the clientside. I can even see them when looking at the players.
Clientside, everything seems to add up. Until “overrideProperties.PrefixTextProperties” is brought into the mix. This is not a property of the TextChatService or custom settings instance created, but autofill works. overrideProperties.PrefixTextProperties.TextColor3 autofills too, but just refuses to be recognized.
This is literally copied and pasted from the documentation, therefore this should not error.
The only modifications I made were the serverside attributes and that print line clientside.
I am mortally confused.
Perhaps I have overlooked something?