So, I’ve been having some issues with TextChatService. Normally, I’d go the regular documentation way, verifying gamepasses on the client and appending the tag on the client itself utilizing the OnIncomingMessage features. However, I’ve started to toy with not trusting the client and maximizing server usage and computation.
What I’ve tried to do so far is attach message metadata and modify the PrefixText itself, but neither seem to be replicating to the client (I’m using :SendingMessage:Connect() on the Server and .OnIncomingMessage = function() on the client) in the way I expected.
I’d try RemoteEvents, but I’m not sure how they’d work in a server full of 24 individuals, especially under large stress tests.
I’ve been getting this upon modifying PrefixText on the server
example here:
TextChatService.SendingMessage:Connect(function(message: TextChatMessage)
local src = if message.TextSource then message.TextSource else nil
local id = if src.UserId then src.UserId else nil
local tag = if Stubs[id] then Stubs[id] else nil -- this ternary statement will have other logic too but for right now there are no products LOL
local props = Instance.new("TextChatMessageProperties") -->> ignore this, btw
message.Metadata = HttpService:JSONEncode({Tag = "AAAAAA"})
message.PrefixText = "AAAAA"
return message
end)
and attempting to retrieve it on client, shown here:
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
local plr = message.TextSource
if not plr then
return
end
local ok, md = pcall(function()
return HttpService:JSONDecode(message.Metadata) -->> i removed the metadata check, it returns nil anyway.
end)
print(message.PrefixText)
end
and it really doesn’t seem to behave how I expect it. I’ve looked at the documentation, but it doesn’t really help me much.
Does anyone have any knowledge on the inner workings of TextChatService so I could even begin to figure this out - or at least help me figure out what workarounds I may need to do to achieve this? That’d be greatly helpful, because I… frankly am at a little bit of a loss.
Sorry if this is a bit of a weird post, it’s 35 past midnight right now. Brain’s a bit fried.