Advertisement
Lean_Man

Chat Spy Window

Jan 26th, 2023
10,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.85 KB | None | 0 0
  1.  
  2. --Red = You
  3. --White = Message
  4. --Green = Friend
  5. --Blue = Other Players
  6. --Magenta = Custom Players
  7. --Warnings = Found Messages
  8.  
  9. FindCommand = "/e Find"
  10.  
  11. --Put Player ID's Here to Give Them Magenta Color
  12. CustomColors = {
  13.     --Put Player ID's here
  14. }
  15.  
  16. rconsolename("Private Messages")
  17. rconsoleprint("@@GREEN@@")
  18.  
  19. local plyr = game.Players.LocalPlayer
  20. local ID = plyr.UserId
  21.  
  22. local getmsg = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents"):WaitForChild("OnMessageDoneFiltering")
  23.  
  24. Messages = {}
  25.  
  26. local LoweredFindCommand = string.lower(FindCommand)
  27.  
  28. plyr.Chatted:Connect(function(msg, r)
  29.     if string.find(msg, FindCommand) then
  30.         local NewMessage = string.lower(msg)
  31.         local newString = string.split(NewMessage, " ")
  32.         for _, z in pairs(Messages) do
  33.             local v = string.lower(z)
  34.             local New_String = string.split(v, " ")
  35.             for i, x in pairs(New_String) do
  36.                 if i >= 4 then
  37.                     if (string.find(New_String[i], newString[3])) and not (string.find(v, LoweredFindCommand)) then
  38.                         rconsolewarn(v)
  39.                     end
  40.                 end
  41.             end
  42.         end
  43.     end
  44. end)
  45.  
  46. function DisplayMessage(msg, player)
  47.     local NewMsg = (msg.."\n")
  48.     local NewName = (player.DisplayName.." - "..player.Name..": ")
  49.     local NewMessageAndName = (NewName..NewMsg)
  50.     table.insert(Messages, NewMessageAndName)
  51.     if player.Name == game.Players.LocalPlayer.Name then
  52.         rconsoleprint("@@RED@@")
  53.     else
  54.         if table.find(CustomColors, player.UserId) then
  55.             rconsoleprint("@@MAGENTA@@")
  56.         elseif player:IsFriendsWith(ID) then
  57.             rconsoleprint("@@GREEN@@")
  58.         else
  59.             rconsoleprint("@@BLUE@@")
  60.         end
  61.     end
  62.     rconsoleprint(NewName)
  63.     rconsoleprint("@@WHITE@@")
  64.     rconsoleprint(NewMsg)
  65. end
  66.  
  67. function OnChat(p, msg)
  68.     local NewMsg = (msg.."\n")
  69.     local NewName = (p.DisplayName.." - "..p.Name..": ")
  70.     local NewMessageAndName = (NewName..NewMsg)
  71.     table.insert(Messages, NewMessageAndName)
  72.  
  73.     msg = msg:gsub("[\n\r]",''):gsub("\t",' '):gsub("[ ]+",' ')
  74.     local hidden = true
  75.     local conn = getmsg.OnClientEvent:Connect(function(packet,channel)
  76.         if packet.SpeakerUserId==p.UserId and packet.Message==msg:sub(#msg-#packet.Message+1) and (channel=="All" or (channel=="Team" and public==false and Players[packet.FromSpeaker].Team==plyr.Team)) then
  77.             hidden = false
  78.         end
  79.     end)
  80.     wait(1)
  81.     conn:Disconnect()
  82.     if hidden then
  83.         DisplayMessage(msg, p)
  84.     end
  85. end
  86.  
  87. function FoundPlayer(player)
  88.     player.Chatted:Connect(function(msg, p)
  89.         OnChat(player, msg)
  90.     end)
  91. end
  92. for _, v in pairs(game.Players:GetChildren()) do
  93.     FoundPlayer(v)
  94. end
  95. game.Players.PlayerAdded:Connect(FoundPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement