Advertisement
LawMixer

Automated Tool Handler

Dec 26th, 2021
1,196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.73 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, Rank, Icon, Team)
  24.             if Type1 == "FreeTool" then
  25.                 Gadgets:WaitForChild(Tool):Clone().Parent = StarterPack
  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.                    
  38.                     Weapons:WaitForChild(Tool):Clone().Parent = StarterPack
  39.             end
  40.         end
  41.  
  42.         if Player.Team == Teams:WaitForChild("Administration") then
  43.             GiveItem("FreeTool", TeamAccess.Administration.GroupId,  "Radio", "Administration")
  44.             GiveItem("FreeWeapon", TeamAccess.Administration.GroupId, "Desert Eagle", "Administration")
  45.             GiveItem("FreeTool", TeamAccess.Administration.GroupId, "Handcuffs", "Administration")
  46.             GiveItem("FreeTool", TeamAccess.Administration.GroupId, "Coffee", "Administration")
  47.             Framework.changeValue(Player, "Administration")
  48.         elseif Player.Team == Teams:WaitForChild("Department of External Affairs") then
  49.             GiveItem("FreeTool", TeamAccess["Department of External Affairs"].GroupId, "Radio", "Department of External Affairs")
  50.             GiveItem("FreeTool", TeamAccess["Department of External Affairs"].GroupId, "Recruiting Paper", "Department of External Affairs")
  51.             GiveItem("FreeTool", TeamAccess["Department of External Affairs"].GroupId, "Coffee", "Department of External Affairs")
  52.             Framework.changeValue(Player, "Department of External Affairs" )
  53.             --elseif Player.Team == Teams:WaitForChild("Chaos Insurgency") then
  54.             --  GiveItem("FreeTool",123, "Radio")
  55.             --  GiveItem("FreeTool", 123, "G36C")
  56.             --  GiveItem("FreeTool", 123, "Luger P08")
  57.             --  Framework.changeValue(Player, "Chaos Insurgency")
  58.         elseif Player.Team == Teams:WaitForChild("Ethics Committee") then
  59.             GiveItem("FreeTool", TeamAccess["Ethics Committee"].GroupId, "Radio", "Ethics Committee")
  60.             GiveItem("FreeTool", TeamAccess["Ethics Committee"].GroupId, "Coffee", "Ethics Committee")
  61.             GiveItem("FreeTool", TeamAccess["Ethics Committee"].GroupId, "Handcuffs", "Ethics Committee")
  62.             Framework.changeValue(Player, "Ethics Committee")
  63.         elseif Player.Team == Teams:WaitForChild("Foundation Personnel") then
  64.             GiveItem("FreeTool", TeamAccess["Foundation Personnel"].GroupId, "Radio", "Foundation Personnel")
  65.             GiveItem("FreeTool", TeamAccess["Foundation Personnel"].GroupId, "Coffee", "Foundation Personnel")
  66.             GiveItem("FreeTool", TeamAccess["Foundation Personnel"].GroupId, "Broom", "Foundation Personnel")
  67.             Framework.changeValue(Player, "Foundation Personnel")
  68.         elseif Player.Team == Teams:WaitForChild("Medical Department") then
  69.             GiveItem("FreeTool", TeamAccess["Medical Department"].GroupId, "Radio", "Foundation Personnel")
  70.             GiveItem("FreeTool", TeamAccess["Medical Department"].GroupId, "First Aid Kit", "Foundation Personnel")
  71.             GiveItem("FreeTool", TeamAccess["Medical Department"].GroupId, "Coffee", "Foundation Personnel")
  72.             Framework.changeValue(Player, "Medical Department")
  73.         elseif Player.Team == Teams:WaitForChild("Scientific Department") then
  74.             GiveItem("FreeTool", TeamAccess["Scientific Department"].GroupId, "Radio", "Scientific Department")
  75.             GiveItem("FreeTool", TeamAccess["Scientific Department"].GroupId, "Coffee", "Scientific Department")
  76.             Framework.changeValue(Player, "Scientific Department")
  77.         elseif Player.Team == Teams:WaitForChild("Security Department")  then
  78.             print("Something")
  79.             GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Radio", "Security Department")
  80.             --GiveItem("FreeWeapon", TeamAccess["Security Department"].GroupId, "Glock 41")
  81.             GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Riot Shield", "Security Department")
  82.             GiveItem("FreeWeapon", TeamAccess["Security Department"].GroupId, "G36C", "Security Department")
  83.             GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Handcuffs", "Security Department")
  84.             GiveItem("FreeTool", TeamAccess["Security Department"].GroupId, "Medkit", "Security Department")
  85.             Framework.changeValue(Player, "Security Department")
  86.             print("Something")
  87.             --elseif Player.Team == Teams:WaitForChild("Mobile Task Force") then
  88.             --  GiveItem("FreeTool", 123, "Radio")
  89.             --  GiveItem("FreeTool", 123, "Desert Eagle")
  90.             --  GiveItem("FreeTool", 123, "Lynx CQ300")
  91.             --  GiveItem("FreeTool", 123, "Riot Shield")
  92.             --  GiveItem("FreeTool", 123, "Handcuffs")
  93.             --  GiveItem("FreeTool", 123, "Medkit")
  94.             --  Framework.changeValue(Player, "Mobile Task Force")
  95.         elseif Player.Team == Teams:WaitForChild("Manufacturing Department") then
  96.             GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Radio", "Manufacturing Department")
  97.             GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Coffee", "Manufacturing Department")
  98.             GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Toolbox", "Manufacturing Department")
  99.             GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Drill", "Manufacturing Department")
  100.             GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Fuel", "Manufacturing Department")
  101.             --GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Screws")
  102.             GiveItem("FreeTool", TeamAccess["Manufacturing Department"].GroupId, "Flashlight", "Manufacturing Department")
  103.             Framework.changeValue(Player, "Manufacturing Department")
  104.             --elseif Player.Team == Teams:WaitForChild("Internal Security Department") then
  105.             --  GiveItem("FreeTool", 123, "Radio")
  106.             --  GiveItem("FreeTool", 123, "M16A2")
  107.             --  GiveItem("FreeTool", 123, "Silenced Glock 41")
  108.             --  GiveItem("FreeTool", 123, "First Aid Kit")
  109.             --  GiveItem("FreeTool", 123, "Handcuffs")
  110.             --  GiveItem("FreeTool", 123, "Classified Shield")
  111.             --  Framework.changeValue(Player, "Internal Security Department")
  112.         elseif Player.Team == Teams:WaitForChild("Class - D") then
  113.             Framework.changeValue(Player, "Class - D")
  114.         end
  115.         end)
  116.         end)
  117. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement