Shortly im making a RP Chat and i did the same 5 months ago but then i lost it and the code is similar to the old but it wont work for some reason
The code
local Plr = game.Players.LocalPlayer
game:GetService("TextChatService").SendingMessage:Connect(function(TextInstance)
if Plr:GetAttribute("RPChat") == true then
TextInstance.Text = "[RP] " .. TextInstance.Text
end
end)
i simplefied the code for easier reading
Edit: I removed the code that adds and changes the attribute for rp chat