✓ Accepted answer
This should assign the proper tools to respective teams. Ensure the ServerStorage folder that houses the tools has them sorted into separate child folders matching the team names. E.g:
ServerStorage
"Tools" - Folder
"Assassins" - Folder
- Tool Instances
Etcetera...
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local ToolSet = ServerStorage.Tools
local function TransferTeamTools(Player)
local Backpack = Player.Backpack
local TeamTools = ToolSet:FindFirstChild(Player.Team.Name)
if (TeamTools) then
Backpack:ClearAllChildren()
for _, Tool in pairs(TeamTools) do
Tool:Clone().Parent = Backpack
end
end
end
end
Players.PlayerAdded:Connect(function(Player)
Player:GetPropertyChangedSignal("Team"):Connect(TransferTeamTools)
end)
2 comments
Are there multiple tools that you want to give the players?
yes