Hi there guys.
My question that I've been thinking about is how to access one of the 3 values found in a Vector3 /RGB value. Sure, you can add or subtract values with CFrame or name these 3 values in a variable beforehand, but what I want to do is some thing like this:
1 | local RGB = Color 3. fromRGB( 23 , 46 , 69 ) |
2 | --Make a variable that gets the first value |
3 | --Make a variable that gets the second value |
4 | --Make a variable that gets the third value |
I've looked into the object browser for any functions to this, but I can't find anything.
Thanks.
For Vector3s you can do Vector.X
, Vector.Y
, Vector.Z
. For Colour3s you can do Colour.R
, Colour.G
and Colour.B
.
Short answer.
1 | local newVector = Vector 3. new( 10 , 20 , 30 ) |
2 | part.Position = Vector 3. new(newVector.X, newVector.Y, 40 ) |
Basically, I positioned a part using only the X and Y components of newVector but used 40 (instead of 30) for the Z coordinate.