One of the most used scripts for Team specific gear seems to have broke :(

--Just put weapons in the team.
function teamFromColor(color) 
for _,t in pairs(game:GetService("Teams"):GetChildren()) do 
if t.TeamColor==color then return t end 
end 
return nil 
end 

function onSpawned(plr) 
local tools = teamFromColor(plr.TeamColor):GetChildren() 
for _,c in pairs(tools) do 
c:Clone().Parent = plr.Backpack 
end 
end 

function onChanged(prop,plr) 
if prop=="Character" then 
onSpawned(plr) 
end 
end 

function onAdded(plr) 
plr.Changed:connect(function(prop) 
onChanged(prop,plr) 
end) 
end 

game.Players.PlayerAdded:connect(onAdded) 

Also wondering if there is a way to do this with Scripts for specific teams.

2 comments

0

If there is an error message what is it? It’s way easier to detect the error this way

0

No error just either seems to spawn for every team or none