local TT = game:GetService("TextChatService")
local Bar = TT.ChatInputBarConfiguration
local Window = TT.ChatWindowConfiguration
local RS = game:GetService("RunService")
local function onFocused()
Bar.BackgroundColor3 = Color3.fromRGB(255,255,255)
Bar.TextColor3 = Color3.fromRGB(25, 27, 29)
Bar.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
end
local function FocusLost()
Bar.BackgroundColor3 = Color3.fromRGB(25, 27, 29)
Bar.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar.TextStrokeColor3 = Color3.fromRGB(0,0,0)
end
local localplayer = game.Players.LocalPlayer
local PlayersService = game:GetService("Players")
local function onMessageReceived(textChatMessage: TextChatMessage)
local textSource = textChatMessage.TextSource
local chattingPlayer = if textSource
then PlayersService:GetPlayerByUserId(textSource.UserId)
else nil
if chattingPlayer then
textChatMessage.PrefixText = (textChatMessage.PrefixText:gsub(chattingPlayer.DisplayName, chattingPlayer.Name))
end
end
local function onSendingMessage(textChatMessage: TextChatMessage)
textChatMessage.PrefixText = (textChatMessage.PrefixText:gsub(localplayer.DisplayName, localplayer.Name))
end
Bar:GetPropertyChangedSignal("IsFocused"):Connect(onFocused)
TT.MessageReceived:Connect(onMessageReceived)
TT.SendingMessage:Connect(onSendingMessage)
RS.Heartbeat:Connect(function()
if not Bar.IsFocused then
FocusLost()
end
end)
Onsendingmessage and onrecieving functions just doesn’t work.
You need to be using TextChatService.OnIncomingMessage
function textChatService.OnIncomingMessage(textChatMessage: TextChatService)
local source = textChatMessage.TextSource
if not source then return end
local player = players:GetPlayerByUserId(source.UserId)
local textChatMessageProperties = Instance.new('TextChatMessageProperties')
textChatMessageProperties.PrefixText = textChatMessage.PrefixText:gsub(player.DisplayName, player.Name)
return textChatMessageProperties
end
local TT = game:GetService("TextChatService")
local Bar = TT.ChatInputBarConfiguration
local Window = TT.ChatWindowConfiguration
local RS = game:GetService("RunService")
local function onFocused()
Bar.BackgroundColor3 = Color3.fromRGB(255,255,255)
Bar.TextColor3 = Color3.fromRGB(25, 27, 29)
Bar.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
end
local function FocusLost()
Bar.BackgroundColor3 = Color3.fromRGB(25, 27, 29)
Bar.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar.TextStrokeColor3 = Color3.fromRGB(0,0,0)
end
local localplayer = game.Players.LocalPlayer
local PlayersService = game:GetService("Players")
local function OnIncomingMessage(textChatMessage: TextChatService)
local source = textChatMessage.TextSource
if not source then return end
local player = PlayersService:GetPlayerByUserId(source.UserId)
local textChatMessageProperties = Instance.new('TextChatMessageProperties')
textChatMessageProperties.PrefixText = textChatMessage.PrefixText:gsub(player.DisplayName, player.Name)
return textChatMessageProperties
end
Bar:GetPropertyChangedSignal("IsFocused"):Connect(onFocused)
TT.OnIncomingMessage(OnIncomingMessage)
RS.Heartbeat:Connect(function()
if not Bar.IsFocused then
FocusLost()
end
end)
local TT = game:GetService("TextChatService")
local Bar = TT.ChatInputBarConfiguration
local Window = TT.ChatWindowConfiguration
local RS = game:GetService("RunService")
local function onFocused()
Bar.BackgroundColor3 = Color3.fromRGB(255,255,255)
Bar.TextColor3 = Color3.fromRGB(25, 27, 29)
Bar.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
end
local function FocusLost()
Bar.BackgroundColor3 = Color3.fromRGB(25, 27, 29)
Bar.TextColor3 = Color3.fromRGB(255, 255, 255)
Bar.TextStrokeColor3 = Color3.fromRGB(0,0,0)
end
local localplayer = game.Players.LocalPlayer
local PlayersService = game:GetService("Players")
local function OnIncomingMessage(textChatMessage: TextChatService)
if not textChatMessage then return end
local source = textChatMessage.TextSource
if not source then return end
local player = PlayersService:GetPlayerByUserId(source.UserId)
local textChatMessageProperties = Instance.new('TextChatMessageProperties')
textChatMessageProperties.PrefixText = textChatMessage.PrefixText:gsub(player.DisplayName, player.Name)
return textChatMessageProperties
end
Bar:GetPropertyChangedSignal("IsFocused"):Connect(onFocused)
TT.OnIncomingMessage = OnIncomingMessage()
RS.Heartbeat:Connect(function()
if not Bar.IsFocused then
FocusLost()
end
end)