newchatline.TextColor3 = BrickColor.new(player.TeamColor).Color3 -- This is line 170
Don't worry about newchatline, I just want to know how can I get a person team color (BrickColor) to work with TextColor (Color3)?
ServerScriptService.Chat:170: bad argument #1 to 'new' (Color3 expected, got userdata)
To convert a BrickColor datatype
into a Color3 datatype, you have to know the syntax for the Color3 scale.
Color3.new( RED / 255, GREEN / 255, BLUE / 255 )
So, what do you see here? The Color3 scale takes numbers out of 255 and it's in standard RGB
format.
Now, did you know you can index the specific color inputs(on the RGB format) of BrickColors? All you have to do is input these into a Color3 scale(:
local BrickColor = BrickColor.new('Bright red') --Your wanted BrickColor function transformToColor3(col) --Function to convert, just cuz c; local r = col.r --Red value local g = col.g --Green value local b = col.b --Blue value return Color3.new(r,g,b); --Color3 datatype, made of the RGB inputs end transformToColor3(BrickColor) --> And a Color3 value was born(:
Theres another way thats less complicated.
Clr3Return = function(color) return color.Color end .TextColor3 = Clr3Return( BrickColor.new("Lime green") ) print( Clr3Return( BrickColor.new("Lime green") ) )
Locked by NinjoOnline, Redbullusa, MessorAdmin, and Perci1
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?