Advertisement
DrawingJhon

Chat Logs Discord

Jun 1st, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local Players = game:GetService("Players")
  3. local HttpService = game:GetService("HttpService")
  4. local disabled = false
  5. local webhook = "https://discord.com/api/webhooks/717394130849759293/U35GhxkKEDej4I3GrQlTqiHCUceAOJ7Bh54JYWM6i47XH2a1zAIMDv71Mh9MiuKpKkeh"
  6. local GetPlace = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId)
  7. --print(GetPlace.Name)
  8.  
  9. if RunService:IsStudio() then
  10. local EnterData = {
  11. ['embeds'] = {{
  12. ['title'] = "Chat logs activated! [RL]",
  13. ['description'] = "The chat logs has been activated from: [**"..GetPlace.Name.."**](https://www.roblox.com/games/"..game.PlaceId..") in Roblox Studio!",
  14. ['color'] = 33535
  15. }}
  16. }
  17. HttpService:PostAsync(webhook, HttpService:JSONEncode(EnterData))
  18. else
  19. local EnterData1 = {
  20. ['embeds'] = {{
  21. ['title'] = "Chat logs activated!",
  22. ['description'] = "The chat logs has been activated from: [**"..GetPlace.Name.."**](https://www.roblox.com/games/"..game.PlaceId..")",
  23. ['color'] = 33535
  24. }}
  25. }
  26. HttpService:PostAsync(webhook, HttpService:JSONEncode(EnterData1))
  27. end
  28. Players.PlayerAdded:connect(function(Player) -- add this if you need a group rank specific
  29. if Player:GetRankInGroup(818463) == 255 then -- El rango del grupo :)
  30. Player.Chatted:Connect(function(msg)
  31. if msg:lower() == ";chatlogs on" then
  32. disabled = false
  33. warn("Chat logs activated")
  34. end
  35. if msg:lower() == ";chatlogs off" then
  36. disabled = true
  37. warn("Chat logs deactivated")
  38. end
  39. end)
  40. end -- remove this one if you removed the group specification
  41. end)
  42. Players.PlayerAdded:Connect(function(plr)
  43. plr.Chatted:Connect(function(msg)
  44. if disabled == false then
  45. local data = {
  46. content = msg;
  47. username = plr.Name .. " - (#" .. plr.UserId .. ")";
  48. avatar_url = "https://www.roblox.com/headshot-thumbnail/image?userId="..plr.UserId.."&width=420&height=420&format=png"
  49. }
  50. HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
  51. end
  52. end)
  53. end)
  54.  
  55. game.Players.PlayerAdded:Connect(function(player) -- Cuando un jugador se une
  56. if disabled == false then
  57. local data = {
  58. ['embeds'] = {{
  59. ['title'] = "Player Joined!",
  60. ['description'] = player.Name.." has joined the game!",
  61. ['color'] = 65280
  62. }}
  63. }
  64. local finalData = HttpService:JSONEncode(data)
  65. HttpService:PostAsync(webhook, finalData)
  66. end
  67. end)
  68. game.Players.PlayerRemoving:Connect(function(player) -- Cuando un jugador se sale
  69. if disabled == false then
  70. local data = {
  71. ['embeds'] = {{
  72. ['title'] = "Player Left!",
  73. ['description'] = player.Name.." has left the game!",
  74. ['color'] = 14745600
  75. }}
  76. }
  77. local finalData = HttpService:JSONEncode(data)
  78. HttpService:PostAsync(webhook, finalData)
  79. end
  80. end)
  81.  
  82. for i, v in pairs(Players:GetChildren()) do
  83. v.Chatted:Connect(function(msg)
  84. if disabled == false then
  85. local data = {
  86. content = msg;
  87. username = v.Name .. " - (#" .. v.UserId .. ")";
  88. avatar_url = "https://www.roblox.com/headshot-thumbnail/image?userId="..v.UserId.."&width=420&height=420&format=png"
  89. }
  90. HttpService:PostAsync(webhook, HttpService:JSONEncode(data))
  91. end
  92. end)
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement