here's the script..
function onRespawn(character,player) teamColor=player.TeamColor for count,a in pairs(game.Teams:GetChildren()) do if a.TeamColor=teamColor then team=a end end if team==nil then return end weps=game.Lighting.TeamsStarterpack:findFirstChild(team.Name) if weps==nil then return end for count,a in pairs(weps:GetChildren()) do weps:clone().Parent=player.Backpack end end workspace.ChildAdded:connect(function(character) player=game.Players:GetPlayerFromCharacter(character) if player~=nil then onRespawn(character,player) end end) player:Kill() end
Line 4 is incorrect. You are using an incorrect operator, =
, which should be ==
. Also, you should practice better indentation, so the code is better to read like so:
function onRespawn(character,player) teamColor = player.TeamColor for _, a in pairs(game.Teams:GetChildren()) do if a.TeamColor == teamColor then teamColor = a end end if team == nil then return end weps = game.Lighting.TeamsStarterpack:findFirstChild(team.Name) if weps == nil then return end for _, a in pairs(weps:GetChildren()) do weps:clone().Parent = player.Backpack end end workspace.ChildAdded:connect(function(character) player = game.Players:GetPlayerFromCharacter(character) if player ~= nil then onRespawn(character, player) end end) player:Kill() end