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
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.