Advertisement
xmaanzach

ManageTeamTools

Jul 31st, 2018
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. local teams = game:GetService("Teams")
  2. local Team1 = game.Teams.Police
  3. local Tools1 = game.ReplicatedStorage.PoliceTools
  4. local Team2 = game.Teams.Criminal
  5. local Tools2 = game.ReplicatedStorage.CriminalTools
  6.  
  7. local function AddTools(backpack, tools, startergear)
  8.  
  9. for _, tool in pairs(tools:GetChildren()) do
  10. tool:Clone().Parent = backpack
  11. tool:Clone().Parent = startergear
  12.  
  13. end
  14. end
  15.  
  16. local function ChangeTeam(player)
  17.  
  18. local backpack = player.Backpack
  19. local startergear = player.StarterGear
  20. backpack:ClearAllChildren()
  21. startergear:ClearAllChildren()
  22.  
  23. if player.Team == Team1 then
  24. AddTools(backpack, Tools1, startergear)
  25.  
  26. elseif player.Team == Team2 then
  27. AddTools(backpack, Tools2, startergear)
  28.  
  29. end
  30. end
  31.  
  32. Team1.PlayerAdded:Connect(ChangeTeam)
  33.  
  34. Team2.PlayerAdded:Connect(ChangeTeam)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement