1 | local ReplicatedStorage = game:FindService("ReplicatedStorage") |
2 | local ChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents") |
3 | local OnMessageEvent = ChatEvents:WaitForChild("OnMessageDoneFiltering") |
4 | local SayMessageRequest = ChatEvents:WaitForChild("SayMessageRequest") |
5 | |
6 | if not SayMessageRequest:IsA("RemoteEvent") or not OnMessageEvent:IsA("RemoteEvent") then return end |
7 | |
8 | local ChatLegth = require(game:FindService("Chat"):WaitForChild("ClientChatModules"):WaitForChild("ChatSettings")).MaximumMessageLength |
9 | local lp = game:FindService("Players").LocalPlayer.Name |
10 | |
11 | OnMessageEvent.OnClientEvent:Connect(function(data) |
12 | if not data then return end |
13 | local player = tostring(data.FromSpeaker) |
14 | if player == lp then return end |
15 | local message = tostring(data.Message) |
16 | if (message):len() <= (ChatLegth-7) then |
17 | SayMessageRequest:FireServer(('\"%s\"%s'):format(message,"🤓"),tostring(data.OriginalChannel)) |
18 | end |
19 | end) |