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

Problem with this 'If Elseif' Statement?

Asked by 10 years ago

So This has worked before, but I need it to be team specific, so I cahnged it to an If-Elseif statement,

But it doesn't work

This is the script

TextButton = script.Parent
redspawns = {game.Workspace.SpawnLocation1 , game.Workspace.SpawnLocation2 , game.Workspace.SpawnLocation3 , game.Workspace.SpawnLocation4}
bluespawns = {game.Workspace.SpawnLocationB1 , game.Workspace.SpawnLocationB2 , game.Workspace.SpawnLocationB3 , game.Workspace.SpawnLocationB4}
player = script.Parent.Parent.Parent.Parent
RedMed = game.ReplicatedStorage.Red.Medigun:Clone()
BlueMed = game.ReplicatedStorage.Blue.Medigun:Clone()

TextButton.MouseButton1Down:connect(function()
        script.Parent.Text = "3"
        wait(0.5)
        script.Parent.Text = "2"
        wait(0.5)
        script.Parent.Text = "1"
        wait(0.5)
        script.Parent.Parent.Frame.Visible = false
        script.Parent.Parent.TextButton.Visible = false
        if player.TeamColor == BrickColor.new("Bright red") then
            RedMed.Parent = player.Backpack
            player.Character:MoveTo(redspawns[math.random(1, #redspawns)].Position)
            player.Character.Humanoid.MaxHealth = 100
            player.Character.Humanoid.Health = 100
            player.Character.Humanoid.WalkSpeed = 20
        elseif player.TeamColor == BrickColor.new("Bright blue") then
            player.Character:MoveTo(bluespawns[math.random(1, #redspawns)].Position)
            BlueMed.Parent = player.Backpack
        end
end)


0
Error on lines 17, and 23: You are attempting to compare 'Bright red' and 'Bright blue' a string value with a 'BrickColor' method, consider changing to 'player.TeamColor == BrickColor.new("Bright red")' and 'player.TeamColor == BrickColor.new("Bright blue")'. TheeDeathCaster 2368 — 10y
0
I'm pretty sure I've tried That already. It didn't work and it still isn't SpazzMan502 133 — 10y

Answer this question