Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does unexpected symbol near ")" mean?

Asked by
Yeevivor4 155
10 years ago
       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.

2 answers

Log in to vote
1
Answered by
Lacryma 548 Moderation Voter
10 years ago

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)
Ad
Log in to vote
0
Answered by 10 years ago
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.

Answer this question