Advertisement
epicgamermoment

aaaa

Jul 21st, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. local httpservice = game:GetService("HttpService") -- Define HTTP Service
  2. local serverstorage = game:GetService("ServerStorage") -- Define Server Storgage
  3. local webhook = "webhook here" -- Webhook URL
  4.  
  5. local modules = serverstorage:WaitForChild("ServerModules",100) -- Server modules folder
  6. local utility = require(modules:WaitForChild("Utility"),100) -- seoncdstoHMS function
  7.  
  8. function sendwebhook(msg,name,id) -- Used for sending webhooks
  9.     local data = {
  10.         content = msg;
  11.         username = name;
  12.         avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashxx=100&y=100&Format=Png&userId="..id
  13.     }
  14.     httpservice:PostAsync(webhook, httpservice:JSONEncode(data))
  15. end
  16.  
  17. game.Players.PlayerAdded:Connect(function(plr)
  18.     if plr:GetRankInGroup(6622873) >= 251 then -- Are they a mod?
  19.         local sessiontime = Instance.new("IntValue") -- Make the time value
  20.         sessiontime.Name = "SessionTime"
  21.         sessiontime.Value = 0
  22.         sessiontime.Parent = plr
  23.        
  24.         sendwebhook(plr.Name.." has started a session!",plr) -- Send to the activity log
  25.        
  26.         spawn(function() -- Seperate thread, for general conveinence
  27.             while wait(1) do
  28.                 sessiontime.Value = sessiontime.Value + 1 -- Track the time!
  29.             end
  30.         end)
  31.     end
  32. end)
  33.  
  34.  
  35.  
  36. game.Players.PlayerRemoving:Connect(function(plr)
  37.     if plr:GetRankInGroup(6622873) >= 251 then -- Are they a mod?
  38.         sendwebhook(plr.Name.." has ended their session. Session time: "..utility.seoncdstoHMS(plr.SessionTime.Value),plr.UserId,plr.Name) -- Send the session time to the logs
  39.     end
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement