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

If statement with TeamColor?

Asked by 8 years ago

I'm trying to make a script for a game of mine and it involves TeamColor in an if statement. For some reason every time the script does not work and the output does not give an error. When I try removing the if statement it works but I need the if statement for what I am doing. So yes, the amount of parents and all that is correct and it is a problem with the if statement itself. What did I do wrong and how can I fix this? Here is the script:

while true do
    local player = script.Parent.Parent.Parent.Parent.Parent
    if player.TeamColor == "Bright blue" then
        script.Parent.P1OnClick.Disabled = false
    end
    wait(0.05)
end

1 answer

Log in to vote
0
Answered by 8 years ago

Line 3, should be...

if player.TeamColor == BrickColor.new("Bright blue") then

Whenever mentioning the actual color, you should always have "BrickColor.new". If this doesn't work, just tell me.

0
Thanks man, sometimes I'm just so stupid and forgetful >.< flamenathan327 20 — 8y
0
Lol, no problem bro. PreciseLogic 271 — 8y
Ad

Answer this question