game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) play = game.Players:GetChildren() for i = 1, #play do if play[i] ~= nil then if play[i].TeamColor == BrickColor.new("Bright red") or ("Bright blue") then game.Lighting.LinkedSword:Clone().Parent = play[i].Backpack end) -- This has the red line under it. end) Hello, thank you for reading. In the Output Value when I put this code in, it says 'unexpected symbol near ")". I do not understand and if anyone can help me, I would highly appreciate it.
You need 3 ends before it and you forgot to add BrickColor.new in the if statement.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) local play = game.Players:GetChildren() for i = 1, #play do if play[i] ~= nil then if play[i].TeamColor == BrickColor.new("Bright red") or play[i].TeamColor == BrickColor.new("Bright blue") then game.Lighting.LinkedSword:Clone().Parent = play[i].Backpack end end end end) end)
As a suggestion, this is far much easier:
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function() if plr.TeamColor == BrickColor.new("Bright red") or plr.TeamColor == BrickColor.new("Bright blue") then game:GetService("Lighting")["LinkedSword"]:Clone().Parent = plr.Backpack end end) end)
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) play = game.Players:GetChildren() for i = 1, #play do if play[i] ~= nil then if play[i].TeamColor == BrickColor.new("Bright red") or ("Bright blue") then game.Lighting.LinkedSword:Clone().Parent = play[i].Backpack end end end end) end)
You forgot a couple of ends mate.