Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- keywordsOnly = true -- only records messages with the keywords
- keywords = -- keywords to look for
- {
- "raid";
- "clan";
- "plan";
- "secret";
- -- add with "string"; format
- }
- users = -- users to relay logs to
- {
- "CortexZero"; -- case matters
- -- add with "string"; format
- }
- DS = game:GetService("DataStoreService"):GetDataStore("chatlog","v3rm")
- function onChat(message,rec,playname)
- if keywordsOnly == false or testString(message) == true then
- DS:UpdateAsync("messageLog",
- function(curlist)
- if not curlist then return {tostring(os.time()).."|"..playname..": "..message} end
- table.insert(curlist,1,tostring(os.time()).."|"..playname..": "..message)
- return curlist
- end)
- end
- end
- function createGUI(play)
- local gui = Instance.new("ScreenGui",play.PlayerGui)
- local tab = DS:GetAsync("messageLog")
- local total = #tab*24
- local sf = Instance.new("ScrollingFrame",gui)
- sf.Size = UDim2.new(0,256,0,120)
- sf.CanvasSize = UDim2.new(0,256,0,total+24)
- local close = Instance.new("TextButton",sf)
- close.Size = UDim2.new(1,0,0,24)
- close.MouseButton1Click:connect(function() gui:Destroy() end)
- close.Text = "CLOSE WINDOW"
- for i,v in pairs(tab) do
- local msg = Instance.new("TextLabel",sf)
- msg.Size = UDim2.new(1,0,0,24)
- msg.TextXAlignment = "Left"
- msg.Text = v
- msg.Position = UDim2.new(0,0,0,i*24)
- if testString(v) == true then
- msg.TextColor3 = Color3.new(.5,0,0)
- end
- end
- end
- function playerJoined(play)
- play.Chatted:connect(function(message,rec) onChat(message,rec,play.Name) end)
- for _,v in pairs(users) do
- if play.Name == v then
- createGUI(play)
- end
- end
- end
- function testString(str)
- for _,v in pairs(keywords) do
- if string.find(str,v) then
- return true
- end
- end
- return false
- end
- game.Players.PlayerAdded:connect(playerJoined)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement