I have a code that checks if the clicker is the teamcolor of the tycoon. This is to prevent other people clicking things on your tycoon. But, it doesn't work. I get no errors and neither does it work. Help?
wait(1) for i, v in pairs(script.Parent.Buttons:GetChildren()) do if v:FindFirstChild("ClickDetector") then v.ClickDetector.MouseClick:connect(function(clicker) if clicker.TeamColor == "Bright blue" then script.Parent.Color.BrickColor = v.BrickColor script.Parent.Parent.Parent.DropColor.Value = v.BrickColor end end) end end
Since TeamColor is a BrickColor value, that's what you need to compare it to!
wait(1) for i, v in pairs(script.Parent.Buttons:GetChildren()) do if v:FindFirstChild("ClickDetector") then v.ClickDetector.MouseClick:connect(function(clicker) if clicker.TeamColor == BrickColor.new("Bright blue") then script.Parent.Color.BrickColor = v.BrickColor script.Parent.Parent.Parent.DropColor.Value = v.BrickColor end end) end end