How come this works...
print("The color is now", a.BrickColor)
and this does not?
print("The color is now " .. a.BrickColor)
Just want to clear up my curiosity.
How come this works...
print("The color is now", a.BrickColor)
and this does not?
print("The color is now " .. a.BrickColor)
Just want to clear up my curiosity.
The .. operator is the string concatenation operator, meaning that it takes one string and joins it to another end to end. You are trying to concatenate a string to a BrickColor datatype, which has no direct conversion to string.
To concatenate the string and BrickColor properly, use the tostringfunction to convert the BrickColor to a string:
print("The color is now " .. tostring(a.BrickColor))
So basically, the ".." operator only links strings together. And in order to link the string to the BrickColor datatype using the ".." operator, you must use the tostring function to change the BrickColor datatype to a string. Correct?
Right
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Well, I think you might get an error saying Cannot concatenate BrickColor.
Exactly, that's the same error I'm getting.