Xarkkz

spychat

Jul 19th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. --This script reveals ALL hidden messages in the default chat
  2. --chat "/spy" to toggle!
  3. enabled = true
  4. --if true will check your messages too
  5. spyOnMyself = true
  6. --if true will chat the logs publicly (fun, risky)
  7. public = false
  8. --if true will use /me to stand out
  9. publicItalics = true
  10. --customize private logs
  11. privateProperties = {
  12. Color = Color3.fromRGB(0,255,255);
  13. Font = Enum.Font.SourceSansBold;
  14. TextSize = 18;
  15. }
  16. --////////////////////////////////////////////////////////////////
  17. local StarterGui = game:GetService("StarterGui")
  18. local Players = game:GetService("Players")
  19. local player = Players.LocalPlayer
  20. local saymsg = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents"):WaitForChild("SayMessageRequest")
  21. local getmsg = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents"):WaitForChild("OnMessageDoneFiltering")
  22. local instance = (_G.chatSpyInstance or 0) + 1
  23. _G.chatSpyInstance = instance
  24.  
  25. local function onChatted(p,msg)
  26. if _G.chatSpyInstance == instance then
  27. if p==player and msg:lower():sub(1,4)=="/spy" then
  28. enabled = not enabled
  29. wait(0.3)
  30. privateProperties.Text = "{SPY "..(enabled and "EN" or "DIS").."ABLED}"
  31. StarterGui:SetCore("ChatMakeSystemMessage",privateProperties)
  32. elseif enabled and (spyOnMyself==true or p~=player) then
  33. msg = msg:gsub("[\n\r]",''):gsub("\t",' '):gsub("[ ]+",' ')
  34. local hidden = true
  35. local conn = getmsg.OnClientEvent:Connect(function(packet,channel)
  36. 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==player.Team)) then
  37. hidden = false
  38. end
  39. end)
  40. wait(1)
  41. conn:Disconnect()
  42. if hidden and enabled then
  43. if public then
  44. saymsg:FireServer((publicItalics and "/me " or '').."{SPY} [".. p.Name .."]: "..msg,"All")
  45. else
  46. privateProperties.Text = "{SPY} [".. p.Name .."]: "..msg
  47. StarterGui:SetCore("ChatMakeSystemMessage",privateProperties)
  48. end
  49. end
  50. end
  51. end
  52. end
  53.  
  54. for _,p in ipairs(Players:GetPlayers()) do
  55. p.Chatted:Connect(function(msg) onChatted(p,msg) end)
  56. end
  57. Players.PlayerAdded:Connect(function(p)
  58. p.Chatted:Connect(function(msg) onChatted(p,msg) end)
  59. end)
  60. privateProperties.Text = "{SPY "..(enabled and "EN" or "DIS").."ABLED}"
  61. StarterGui:SetCore("ChatMakeSystemMessage",privateProperties)
  62. local chatFrame = player.PlayerGui.Chat.Frame
  63. chatFrame.ChatChannelParentFrame.Visible = true
  64. chatFrame.ChatBarParentFrame.Position = chatFrame.ChatChannelParentFrame.Position+UDim2.new(UDim.new(),chatFrame.ChatChannelParentFrame.Size.Y)
Add Comment
Please, Sign In to add comment