The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
ChatSpy script pastebin roblox
By LINK GAME on 2024-09-18 08:00 am | Syntax: LUA | Views: 13



New Script | Raw | Show/Hide line no. | Copy text to clipboard
  1. local StarterGui = game:GetService("StarterGui")
  2. local Players = game:GetService("Players")
  3. local player = Players.LocalPlayer
  4. local saymsg = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents"):WaitForChild("SayMessageRequest")
  5. local getmsg = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents"):WaitForChild("OnMessageDoneFiltering")
  6. local instance = (_G.chatSpyInstance or 0) + 1
  7. _G.chatSpyInstance = instance
  8.  
  9. local function onChatted(p,msg)
  10.         if _G.chatSpyInstance == instance then
  11.                 if p==player and msg:lower():sub(1,4)=="/spy" then
  12.                         enabled = not enabled
  13.                         wait(0.3)
  14.                         privateProperties.Text = "{SPY "..(enabled and "EN" or "DIS").."ABLED}"
  15.                         StarterGui:SetCore("ChatMakeSystemMessage",privateProperties)
  16.                 elseif enabled and (spyOnMyself==true or p~=player) then
  17.                         msg = msg:gsub("[\n\r]",''):gsub("\t",' '):gsub("[ ]+",' ')
  18.                         local hidden = true
  19.                         local conn = getmsg.OnClientEvent:Connect(function(packet,channel)
  20.                                 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
  21.                                         hidden = false
  22.                                 end
  23.                         end)
  24.                         wait(1)
  25.                         conn:Disconnect()
  26.                         if hidden and enabled then
  27.                                 if public then
  28.                                         saymsg:FireServer((publicItalics and "/me " or '').."{SPY} [".. p.Name .."]: "..msg,"All")
  29.                                 else
  30.                                         privateProperties.Text = "{SPY} [".. p.Name .."]: "..msg
  31.                                         StarterGui:SetCore("ChatMakeSystemMessage",privateProperties)
  32.                                 end
  33.                         end
  34.                 end
  35.         end
  36. end
  37.  
  38. for _,p in ipairs(Players:GetPlayers()) do
  39.         p.Chatted:Connect(function(msg) onChatted(p,msg) end)
  40. end
  41. Players.PlayerAdded:Connect(function(p)
  42.         p.Chatted:Connect(function(msg) onChatted(p,msg) end)
  43. end)
  44. privateProperties.Text = "{SPY "..(enabled and "EN" or "DIS").."ABLED}"
  45. StarterGui:SetCore("ChatMakeSystemMessage",privateProperties)
  46. local chatFrame = player.PlayerGui.Chat.Frame
  47. chatFrame.ChatChannelParentFrame.Visible = true
  48. chatFrame.ChatBarParentFrame.Position = chatFrame.ChatChannelParentFrame.Position+UDim2.new(UDim.new(),chatFrame.ChatChannelParentFrame.Size.Y)