LawMixer

Automated Tool Handler

Dec 26th, 2021 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.89 KB | None | 0 0
  1. local ServerScriptService = game:GetService("ServerScriptService")
  2. local Framework = require(ServerScriptService.Services.Framework)
  3.  
  4. local Tools = game.ServerStorage.Tools
  5. local Gadgets = Tools.Gadgets
  6. local Weapons = Tools.Weapons
  7. local Teams = game.Teams
  8.  
  9.  
  10. game.Players.PlayerAdded:Connect(function(Player)
  11. local TeamAccess = require(game.ReplicatedStorage.Framework.TeamsModule)
  12. local StarterPack = Player:WaitForChild("StarterGear")
  13.  
  14. Player.CharacterAdded:Connect(function(char)
  15.  
  16. char:WaitForChild("Humanoid").Died:Connect(function()
  17. if not Player:FindFirstChild("Clearance") then
  18. local Clearance = game.ServerStorage.Clearance:Clone()
  19. Clearance.Parent = Player
  20. else
  21. print("Already cloned the clearance folder into the player")
  22. end
  23. local function GiveItem(Type1, GroupId, Tool, Team)
  24. if Type1 == "FreeTool" and Player.Team == game.Teams:FindFirstChild(Team) then
  25. Gadgets:WaitForChild(Tool):Clone().Parent = Player.Backpack
  26. end
  27.  
  28. -- gives weapon
  29. --if Type1 == "RankWeapon" then
  30. -- if Player:GetRankInGroup(GroupId) == Rank and Player.Team == game.Teams:FindFirstChild(Team) then
  31. -- Weapons:WaitForChild(Tool):Clone().Parent = StarterPack
  32. -- print("Something")
  33. -- end
  34. --end
  35.  
  36. if Type1 == "FreeWeapon" then
  37. if Player.Team == game.Teams:FindFirstChild(Team) then
  38. print(Player.Team, Player)
  39. Weapons:WaitForChild(Tool):Clone().Parent = Player.Backpack
  40. end
  41. end
  42. end
  43.  
  44. if Player.Team == Teams:WaitForChild("Administration") then
  45. GiveItem("FreeTool", TeamAccess.Administration.GroupId, "Radio", "Administration")
  46. GiveItem("FreeWeapon", TeamAccess.Administration.GroupId, "Desert Eagle", "Administration")
  47. GiveItem("FreeTool", TeamAccess.Administration.GroupId, "Handcuffs", "Administration")
  48. GiveItem("FreeTool", TeamAccess.Administration.GroupId, "Coffee", "Administration")
  49. Framework.changeValue(Player, "Administration")
  50. elseif Player.Team == Teams:WaitForChild("Department of External Affairs") then
  51. GiveItem("FreeTool", TeamAccess["Department of External Affairs"].GroupId, "Radio", "Department of External Affairs")
  52. GiveItem("FreeTool", TeamAccess["Department of External Affairs"].GroupId, "Recruiting Paper", "Department of External Affairs")
  53. GiveItem("FreeTool", TeamAccess["Department of External Affairs"].GroupId, "Coffee", "Department of External Affairs")
  54. Framework.changeValue(Player, "Department of External Affairs" )
  55. --elseif Player.Team == Teams:WaitForChild("Chaos Insurgency") then
  56. -- GiveItem("FreeTool",123, "Radio")
  57. -- GiveItem("FreeTool", 123, "G36C")
  58. -- GiveItem("FreeTool", 123, "Luger P08")
  59. -- Framework.changeValue(Player, "Chaos Insurgency")
  60. elseif Player.Team == Teams:WaitForChild("Ethics Committee") then
  61. GiveItem("FreeTool", TeamAccess["Ethics Committee"].GroupId, "Radio", "Ethics Committee")
  62. GiveItem("FreeTool", TeamAccess["Ethics Committee"].GroupId, "Coffee", "Ethics Committee")
  63. GiveItem("FreeTool", TeamAccess["Ethics Committee"].GroupId, "Handcuffs", "Ethics Committee")
  64. Framework.changeValue(Player, "Ethics Committee")
  65. elseif Player.Team == Teams:WaitForChild("Foundation Personnel") then
  66. GiveItem("FreeTool", TeamAccess["Foundation Personnel"].GroupId, "Radio", "Foundation Personnel")
  67. GiveItem("FreeTool", TeamAccess["Foundation Personnel"].GroupId, "Coffee", "Foundation Personnel")
  68. GiveItem("FreeTool", TeamAccess["Foundation Personnel"].GroupId, "Broom", "Foundation Personnel")
  69. Framework.changeValue(Player, "Foundation Personnel")
  70. elseif Player.Team == Teams:WaitForChild("Medical Department") then
  71. GiveItem("FreeTool", TeamAccess["Medical Department"].GroupId, "Radio", "Foundation Personnel")
  72. GiveItem("FreeTool", TeamAccess["Medical Department"].GroupId, "First Aid Kit", "Foundation Personnel")
  73. GiveItem("FreeTool", TeamAccess["Medical Department"].GroupId, "Coffee", "Foundation Personnel")
  74. Framework.changeValue(Player, "Medical Department")
  75. elseif Player.Team == Teams:WaitForChild("Scientific Department") then
  76. GiveItem("FreeTool", TeamAccess["Scientific Department"].GroupId, "Radio", "Scientific Department")
  77. GiveItem("FreeTool", TeamAccess["Scientific Department"].GroupId, "Coffee", "Scientific Department")
  78. Framework.changeValue(Player, "Scientific Department")
  79. elseif Player.Team == Teams:WaitForChild("Security Department") then
  80. print("Something")
  81. --GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Radio", "Security Department")
  82. --GiveItem("FreeWeapon", TeamAccess["Security Department"].GroupId, "Glock 41")
  83. GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Riot Shield", "Security Department")
  84. GiveItem("FreeWeapon", TeamAccess["Security Department"].GroupId, "G36C", "Security Department")
  85. GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Handcuffs", "Security Department")
  86. GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Medkit", "Security Department")
  87. Framework.changeValue(Player, "Security Department")
  88. print("Something")
  89. --elseif Player.Team == Teams:WaitForChild("Mobile Task Force") then
  90. -- GiveItem("FreeTool", 123, "Radio")
  91. -- GiveItem("FreeTool", 123, "Desert Eagle")
  92. -- GiveItem("FreeTool", 123, "Lynx CQ300")
  93. -- GiveItem("FreeTool", 123, "Riot Shield")
  94. -- GiveItem("FreeTool", 123, "Handcuffs")
  95. -- GiveItem("FreeTool", 123, "Medkit")
  96. -- Framework.changeValue(Player, "Mobile Task Force")
  97. elseif Player.Team == Teams:WaitForChild("Manufacturing Department") then
  98. GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Radio", "Manufacturing Department")
  99. GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Coffee", "Manufacturing Department")
  100. GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Toolbox", "Manufacturing Department")
  101. GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Drill", "Manufacturing Department")
  102. GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Fuel", "Manufacturing Department")
  103. --GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Screws")
  104. GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Flashlight", "Manufacturing Department")
  105. Framework.changeValue(Player, "Manufacturing Department")
  106. --elseif Player.Team == Teams:WaitForChild("Internal Security Department") then
  107. -- GiveItem("FreeTool", 123, "Radio")
  108. -- GiveItem("FreeTool", 123, "M16A2")
  109. -- GiveItem("FreeTool", 123, "Silenced Glock 41")
  110. -- GiveItem("FreeTool", 123, "First Aid Kit")
  111. -- GiveItem("FreeTool", 123, "Handcuffs")
  112. -- GiveItem("FreeTool", 123, "Classified Shield")
  113. -- Framework.changeValue(Player, "Internal Security Department")
  114. elseif Player.Team == Teams:WaitForChild("Class - D") then
  115. Framework.changeValue(Player, "Class - D")
  116. end
  117. end)
  118. end)
  119. end)
Add Comment
Please, Sign In to add comment