Advertisement
ChrisRodman55

Untitled

Apr 21st, 2020
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.16 KB | None | 0 0
  1. local Datastore = game:GetService("DataStoreService")
  2. local PointsValue = Datastore:GetDataStore("PointsSaved")
  3. local MarketPlaceService = game:GetService("MarketplaceService")
  4. local Events = game.ReplicatedStorage.GiveSystem
  5. local Pending = {}
  6.  
  7. -- Give Item
  8. Events.GiveItems.OnServerEvent:Connect(function(From, To, Items)
  9.     if From:GetRankInGroup(5698560) >=5 then
  10.     local ValidItems = {}
  11.     local text = From.Name.." sent "
  12.     for _, Item in pairs(Items) do
  13.         if game.ReplicatedStorage.AdminFolder.ServerValidateTool:Invoke(From, Item) then
  14.             table.insert(ValidItems, Item)
  15.             text = text..Item.Name..", "
  16.             Item.Parent = nil
  17.         else
  18.             game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(From, "Trying to send "..Item.Name.." to "..To.Name".")
  19.         end
  20.     end
  21.     if From == To then
  22.         game.ReplicatedStorage.AdminFolder.ServerReportExploit:Fire(From, "Attempt to give items to themselves.")
  23.     else
  24.         local Gui = script.RecieveItem:Clone()
  25.         Gui.From.Value = From
  26.         local id = #Pending + 1
  27.         Pending[id] = ValidItems
  28.         Gui.ItemGroupId.Value = id
  29.         Gui.Frame.Question.Text = "Would you like to recieve "..#ValidItems.."items from "..From:GetRoleInGroup(4464296)..", "..From.Name.."?"
  30.         Gui.Parent = To.PlayerGui
  31.         game.ReplicatedStorage.AdminFolder.GiveLog:Fire(text:sub(1, -3).." to "..To.Name)
  32.     end
  33.     end
  34. end)
  35.  
  36. -- Add point
  37. Events.AcceptItems.OnServerEvent:Connect(function(From, Target, id)
  38.     if Target:GetRankInGroup(5698560) >= 5 then
  39.     local text = From.Name.." accepted "
  40.     for _, Item in pairs(Pending[id]) do
  41.         text = text..Item.Name..", "
  42.         Item.Parent = From.Backpack
  43.     end
  44.     Target.leaderstats.Points.Value = Target.leaderstats.Points.Value+1
  45.     Pending[id] = nil
  46.     game.ReplicatedStorage.AdminFolder.GiveLog:Fire(text:sub(1, -3).." from "..Target.Name)
  47. end
  48. end)
  49.  
  50. -- Revoke point
  51. Events.RefuseItems.OnServerEvent:Connect(function(From, Target, id)
  52.     if Target:GetRankInGroup(5698560) >= 5 then
  53.     local text = From.Name.." refused "
  54.     for _, Item in pairs(Pending[id]) do
  55.         text = text..Item.Name..", "
  56.         Item.Parent = Target.Backpack
  57.     end
  58.     Pending[id] = nil
  59.     game.ReplicatedStorage.AdminFolder.GiveLog:Fire(text:sub(1, -3).." from "..Target.Name)
  60. end
  61. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement