local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")
task.wait(1)
TextChatService.OnIncomingMessage = function(Message)
if Message.TextSource then
local Player = Players:GetPlayerByUserId(Message.TextSource.UserId)
local Character = Player.Character
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if Player.DisplayName == "John Doe" or Player.DisplayName == "Roblox" then
Message.PrefixText = Humanoid.DisplayName .. " :"
end
end
end```
#changing player chat name not working
1 messages · Page 1 of 1 (latest)
Hi, what’s not working?
oh my days i did not respond for so long
so sorry
but uhh basically, i wanna make it so that someones name changes into John Doe or Roblox depending on their Humanoid.DisplayName
but it only appears to one client but not all players
Hmm... you're a scripter... can you smell it? let me give you a hint... localscript?
Anyways if it happens to one client not all, it seems like the script needs to be a serverscript not localscript. If you don't know what this means, this means you need to use remoteevents to pass along the name to change to the server script, where the server will interpret that and change the text on all clients.
uhh brother, it cant be serverscript
if it can be, i wouldnt be here whining about my issue
TextService.OnIncomingMessage only works on client
also secondly, this worked in a 2 player simulation, but not in a real game
Hmm I see mate, but TextChatService.OnServerReceivingMessage isn't client-only
Here is the code
** You are now Level 8! **
local TextChatService = game:GetService("TextChatService")
TextChatService.OnServerReceivingMessage = function(textChatMessage)
local speaker = textChatMessage.TextSource
if not speaker then return end
local player = game.Players:GetPlayerByUserId(speaker.UserId)
if not player then return end
if player.DisplayName == "John Doe" or player.DisplayName == "Roblox" then
local prefix = player.DisplayName ... "" --I don't know the symbol so just put it in the string
local newText = prefix .. textChatMessage.Text
-- Return message as table
return {
Text = newText,
Metadata = textChatMessage.Metadata,
TextChannel = textChatMessage.TextChannel,
PrefixText = textChatMessage.PrefixText,
ShouldDeliver = true
}
end
end

what the heck?
oh shoot thats a thing?
that is not a thing
Notice it is NOT an event so you don’t use :Connect(function())