Advertisement
yoitzErrorYT

roblox chat spy

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