I was able to change the color and text before a message is sent, and also detect if it’s a public message/team message/whisper message. Although I couldn’t figure out how to have the settings applied on a single message(the settings apply on every message visible), I am leaving this here hoping someone will find a solution:
--LocalScript inside StarterGui
local Chat = game:GetService("Chat")
local PlayerGui = script.Parent
function RecursiveWait(names, t)
names = string.split(names, ".")
local current = PlayerGui
for i, name in pairs(names) do
current = current:WaitForChild(name, t)
if not current then
warn(name.." wasn't found!("..script.Name..")")
return nil
end
end
return current
end
local Scroller = RecursiveWait("Chat.Frame.ChatChannelParentFrame.Frame_MessageLogDisplay.Scroller", 5)
if not Scroller then return end
local chatSettings = {
BubbleDuration = 15,
MaxBubbles = 3,
BackgroundColor3 = Color3.fromRGB(250, 250, 250),
TextColor3 = Color3.fromRGB(57, 59, 61),
TextSize = 16,
Font = Enum.Font.GothamSemibold,
Transparency = .1,
CornerRadius = UDim.new(0, 12),
TailVisible = true,
Padding = 8, -- in pixels
MaxWidth = 300, --in pixels
VerticalStudsOffset = 0,
BubblesSpacing = 6,
MinimizeDistance = 40,
MaxDistance = 100,
}
function filterTextBoxes(textBoxes)
for _, textBox in pairs(textBoxes) do
if string.find(textBox.Text, "{To") or string.find(textBox.Text, "{From") then
return "whisper"
elseif string.find(textBox.Text, "{Team}") then
return "team"
end
end
end
Scroller.ChildAdded:Connect(function(child)
if not child:IsA("Frame") then return end
local Label = child:WaitForChild("TextLabel", 5)
if not Label then return end
local messageType = filterTextBoxes(Label:GetChildren())
if messageType == "whisper" then
chatSettings.TextColor3 = Color3.fromRGB(0, 0, 0)
chatSettings.BackgroundColor3 = Color3.fromRGB(255, 200, 0)
elseif messageType == "team" then
chatSettings.TextColor3 = Color3.new(1, 1, 1)
chatSettings.BackgroundColor3 = Label.TextColor3
else
chatSettings.TextColor3 = Color3.fromRGB(57, 59, 61)
chatSettings.BackgroundColor3 = Color3.fromRGB(250, 250, 250)
end
Chat:SetBubbleChatSettings(chatSettings)
end)