Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

If statement with TeamColor?

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

✓ Accepted answer

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.

2 comments

0

Thanks man, sometimes I'm just so stupid and forgetful >.<

0

Lol, no problem bro.

This discussion is preserved as it was. New answers, comments, and votes are closed.