Answered by
4 years ago Edited 4 years ago
Create a Folder Inside of ServerStorage, Call it "Tools".
Create a Folder for every team inside of the first, name each the team's name and put the team's tools inside it.
Put this script in ServerScriptService:
01 | local ServerStorage = game:GetService( "ServerStorage" ) |
02 | local Teams = game:GetService( "Teams" ) |
03 | local Tools = ServerStorage:FindFirstChild( "Tools" ) |
05 | function ClearTools(Backpack,StarterGear) |
06 | for i,v in ipairs (Backpack:GetChildren()) do |
11 | for i,v in ipairs (StarterGear:GetChildren()) do |
18 | function TeamPlayerAdded(Player,Team) |
19 | local Backpack = Player:WaitForChild( "Backpack" , 3 ) |
20 | local StarterGear = Player:WaitForChild( "StarterGear" , 3 ) |
21 | if Backpack and StarterGear then |
22 | ClearTools(Backpack,StarterGear) |
23 | local TeamTools = Tools:FindFirstChild(Team.Name) |
25 | for i,v in ipairs (TeamTools:GetChildren()) do |
27 | v:Clone().Parent = Backpack |
28 | v:Clone().Parent = StarterGear |
35 | for i,v in ipairs (Teams:GetTeams()) do |
36 | v.PlayerAdded:Connect( function (Player) |
37 | TeamPlayerAdded(Player,v) |
Tools reset each time player changes teams