OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 08:44 AM |
Part.BrickColor = BrickColor.new(Color.Value)
Something like that is basically an example, but i keep getting an errors similar to this:
08:42:03.220 - Players.Player.PlayerGui.ScreenGui.Script:22: bad argument #1 to 'new' (Color3 expected, got userdata)
Anyone know what i'm doing wrong?
By the way, i'm trying to change a bricks color using a BrickColorValue in case you wanted to know.... |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 15 Jun 2015 08:51 AM |
http://wiki.roblox.com/index.php?title=BrickColor BrickColor.new(BrickColor colour) doesn't exist As your object is a BrickColorValue, you should just do part.BrickColor = colour.Value; |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 09:15 AM |
What if i tried to change it using the name of an object instead of a value?
brick.BrickColor = BrickColor.new(colors.Name)
It would change the color of the brick, but instead of changing it to the correct color it changes it to grey.... |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 15 Jun 2015 09:17 AM |
| Is the name a correct brick colour name? It may be incorrect and BrickColor.new() defaults to grey for incorrect values possibly. |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 09:22 AM |
The name of the part:
"Brick yellow" (Without quotes) |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Jun 2015 09:26 AM |
I don't think that brick yellow is a valid color lol. Let's say the value was this: local value = "Really red" you can do this part.BrickColor = BrickColor.new(value) If your value isn't a string value/BrickColor value then use tostring part.BrickColor = BrickColor.new(tostring(value)) |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 09:28 AM |
| Hover your mouse over the color in the color palette in the 4th row, first color. There you will find the color "Brick yellow". |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 09:37 AM |
| That still makes it grey btw. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Jun 2015 09:40 AM |
That's a weird color. Post script what type of instance is the value? Or is it just a variable? |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 09:44 AM |
| Well, it's not a value to begin with, but the instance i'm using (assuming you mean what type of object i'm using) is a simple "TextButton". Since i only need the name, i thought that it doesn't matter what type of instance i use. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Jun 2015 09:46 AM |
Oh.
BrickColor.new(tostring(textbutton.Text)) |
|
|
| Report Abuse |
|
|
OKevinO
|
  |
| Joined: 05 May 2010 |
| Total Posts: 1036 |
|
|
| 15 Jun 2015 09:51 AM |
| I'll try to use tostring, but i'm using the name of the TextButton, not the text. But the main issue is revolving around the output of the color change, since no error messages appear in the output after trying to change the color. Basically saying that the color DOES change, but the only color it changes to is grey, not to the color i need it to change to. |
|
|
| Report Abuse |
|
|
Infocus
|
  |
| Joined: 28 Apr 2011 |
| Total Posts: 8022 |
|
|
| 15 Jun 2015 10:07 AM |
That happens at times, I pretty much realized roblox's output isn't 100% accurate. Instead of textbox.Text, just use textbox.Name, use tostring |
|
|
| Report Abuse |
|
|