Custom PrefixText Tag not replicating to other clients on message sent except the user

So it confuses me how the tag I created is only replicating to the individual client. But the others can’t see that tag placed on that individual player? I don’t know how to go about replicating it to others…

Ex… I can see in the chat my name is displayed as “[Developer] soul: (Message Sent Here)”, but others cant? Others only see “soul: (Message Sent Here)”

local RS = game:GetService("ReplicatedStorage")
local TCS = game:GetService("TextChatService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local enablerole = false

RS:WaitForChild("UsableRankFolder"):WaitForChild("RankEnabler").OnClientEvent:Connect(function()
	enablerole = not enablerole
end)

local succ, err = pcall(function()
	TCS.OnIncomingMessage = function(message)
		local properties = Instance.new("TextChatMessageProperties")
		
		if message.TextSource and enablerole == true then

			if message.TextSource.Name == game.Players:GetNameFromUserIdAsync(plr.UserId) and plr:IsInGroup(5313957) then		
				properties.PrefixText = ("<font color='#DE0909'>["..plr:GetRoleInGroup(5313957).."]</font> "..char:WaitForChild("Humanoid").DisplayName)
			end

		end
		
		return properties
	end
end)

if err then
	warn(err)
end

Nevermind everyone, after hours of brainstorming this solution came up.

local succ, err = pcall(function()
	TCS.OnIncomingMessage = function(message)
		local OtherUser
		
		if message.TextSource.Name ~= plr.Name then
			for _,v in game.Players:GetChildren() do
				if v.Name == message.TextSource.Name then
					OtherUser = v
				end
			end
			local OtherUserChar = OtherUser.Character
			message.PrefixText = ("<font color='#DE0909'>["..OtherUser:GetRoleInGroup(5313957).."]</font> "..OtherUserChar:WaitForChild("Humanoid").DisplayName)
		end
		
		local properties = Instance.new("TextChatMessageProperties")
		
		if message.Status == Enum.TextChatMessageStatus.Sending and message.TextSource.Name == plr.Name then
			properties.PrefixText = ("<font color='#DE0909'>["..plr:GetRoleInGroup(5313957).."]</font> "..char:WaitForChild("Humanoid").DisplayName)
		end
		
		return properties
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.