This script isn't mine and the person who made it didn't explain how it worked in their video. It was working for a couple of hours however, all of a sudden it is now coming up with an error. As a result of the error it is no longer working.
To explain what it is supposed to do, when you join each team you are given their specific gear (in my case key-cards). When you re-spawn you still have those key-cards.
This is the script
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)
and this is the error that it is coming up with 16:40:30.121 - TeamColor is not a valid member of Script The error takes me to line 6
add a check in
teamFromColor to make sure that
t is a Team.
Edit the teamFromColor function.
local function getTeamFromBrickColor(color) local TeamsService = game:GetService("Teams") local TeamsTable = Teams:GetChildren() for _, team in pairs(TeamsTable) do if team:IsA("Team") then -- if Instance is a team if team.BrickColor == color then return team -- return the team end end end end