Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local StarterGui = game:GetService("StarterGui")
- local Players = game:GetService("Players")
- local LocalPlayer = Players.LocalPlayer
- if(_G.CSConnections)then
- for _, con in next,_G.CSConnections do
- con:Disconnect()
- end
- end
- local function sysMsg(Text: string)
- local Message = {
- Color = Color3.fromRGB(0,255,255);
- Font = Enum.Font.SourceSansBold;
- TextSize = 18;
- }
- Message.Text = Text
- StarterGui:SetCore("ChatMakeSystemMessage",Message)
- end
- local Chat = LocalPlayer.PlayerGui.Chat.Frame.ChatChannelParentFrame.Frame_MessageLogDisplay.Scroller :: Frame
- local OnMessageDoneFiltering = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents"):WaitForChild("OnMessageDoneFiltering")
- _G.CSConnections = {}
- local PlayersLastMessage = {}
- local PlayersLastTarget = {}
- _G.CSConnections['chat'] = Chat.ChildAdded:Connect(function(child)
- if #child.TextLabel:GetChildren() >= 2 then return end
- if not child.TextLabel:FindFirstChild("TextButton") then return end
- local yield
- yield = child.TextLabel.Changed:Connect(function(p)
- if p == "Text" then
- yield:Disconnect() yield = nil
- end
- end) table.insert(_G.CSConnections, C)
- repeat task.wait()
- until not yield
- local Text = child.TextLabel.Text:match('<font.-</font>(.*)') :: TextLabel
- local Name = child.TextLabel.TextButton.Text:match("%[(.*)%]") :: TextButton
- PlayersLastMessage[Name] = Text
- end)
- local function OnChatted(message, isMuted, speakerDisplay)
- local isWhisper, Target, privMessage = message:match('(/w%s(.-)%s%s?(.*))')
- message = privMessage or message
- local notInChat = (message ~= PlayersLastMessage[speakerDisplay])
- local isPrivate = (isWhisper or notInChat)
- if not isPrivate then return end
- if Target then
- Target = Players[Target].DisplayName
- end
- local lastTarget = PlayersLastTarget[speakerDisplay]
- sysMsg("["..speakerDisplay.." -> "..(Target or lastTarget or '?').."]: "..message)
- PlayersLastTarget[speakerDisplay] = Target or lastTarget
- end
- local blockedIds = StarterGui:GetCore("GetBlockedUserIds")
- local function isBlocked(player: Player)
- for _, blockedId in pairs(blockedIds) do
- if player.UserId == blockedId then
- return true
- end
- end
- return false
- end
- local SpyEnabled = true
- _G.CSConnections['self_logger'] = OnMessageDoneFiltering.OnClientEvent:Connect(function(packet, channel)
- if packet.Message:match("/spy") then
- SpyEnabled = not SpyEnabled
- sysMsg("[[ Spy::"..(SpyEnabled and "ON" or "OFF").." ]]")
- end end)
- sysMsg("[ Spying Chats ]")
- for _, Player: Player in next, Players:GetPlayers() do
- if Player.Name == LocalPlayer.Name or isBlocked(Player) then continue end
- local Connection = Player.Chatted:Connect(function(a,b)
- if not SpyEnabled then return end
- task.wait(.05) -- To wait for the ChildAdded to process the message
- OnChatted(a,b, Player.DisplayName)
- end)
- table.insert(_G.CSConnections, Connection)
- end
Advertisement
Add Comment
Please, Sign In to add comment