|
| 25 Apr 2016 09:54 PM |
local Color = Instance.new("String Value") Color.Value = "Bright green"
game.Workspace.Part.BrickColor = BrickColor.new(Color.Value)
Is pretty much what I'm trying to do but does nothing.It will print "Bright green" but won't change the brick's color.
|
|
|
| Report Abuse |
|
|
| |
|
unroot
|
  |
| Joined: 18 Sep 2009 |
| Total Posts: 1114 |
|
|
| 25 Apr 2016 10:06 PM |
Try Instance.new("StringValue"), although I'm not entirely sure if that will effect it. Other than that I don't really know, that's weird..
#code print("yolo" .. string.rep("o", math.huge)) |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 10:06 PM |
do
script.Parent.BrickColor = BrickColor.new("color here")
#code 'dumbness found' |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 10:07 PM |
Assuming that this is a copy/paste and not a rewritten version, there shouldn't be a space when you're creating it.
local Color = Instance.new("StringValue") |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 10:11 PM |
Yeah it's rewritten, my bad on the space.
What I'm trying to do is set the brickcolor of a brick that gets cloned into and welded onto player.Character. The player has a saved string value called HairColor and sets the brickcolor of the hair brick to that color...full code if anyone's interested:
CloneModule.Hair(char, "Hair1", Hair1.Value) -- ignore this its a module function CloneModule.Hair(char, "Hair2", Hair2.Value)-- ignore this its a module function print 'gave hair' char:FindFirstChild("Hair1").BrickColor = BrickColor.new(HairColor.Value) --// string to brickcolor char:FindFirstChild("Hair2").BrickColor = BrickColor.new(HairColor.Value) --// string to brickcolor print(BrickColor.new(HairColor.Value)) print 'colored hair' ---------- Everything prints fine but it doesn't set the brickcolor
print(BrickColor.new(HairColor.Value)) -- would print "Mauve" if the stringvalue's value was "Mauve"
|
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Apr 2016 10:22 PM |
| The only thing that I can think of is that the part isnt there. It could be because the script is simply doing it before the part is added/welded. Add a check prior to and after you set the color to see if the part is there or not. |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 10:24 PM |
FindFirstChild would error if it wasn't there. I'll try WaitForChild
|
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 10:32 PM |
nope. it goes through but still doesnt change color ugh
|
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Apr 2016 10:41 PM |
| Are there any other scripts that may be changing the color of the brick or deleting it upon a change and then immediately re-adding it? |
|
|
| Report Abuse |
|
|
|
| 25 Apr 2016 10:43 PM |
Sorry if this is a stupid question but is this a mesh on a brick or is this a brick??
|~Cherry Studios~| |
|
|
| Report Abuse |
|
|
| |
|
|
| 26 Apr 2016 12:58 AM |
local Color = Instance.new("StringValue") Color.Value = "Bright Green"
game.Workspace.Part.BrickColor = BrickColor.new(Color.Value) |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 26 Apr 2016 01:17 AM |
lol
local Color = Instance.new("StringValue",workspace) *
|
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 05:26 AM |
@time Read my other post with code, I'm grabbing the value correctly @The_Countess It's a brick with a specialmesh inside it for the hair but the textureId is empty so it should change color based on the BrickColor of the brick
@The_Ben No. In the character customization when it adds/removes hats and colors them it works fine. But that's in a localscript. I'm doing all this from a serverscript which is apparently causing problems but when I manually change BrickColor from server log it will change it
|
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 05:32 AM |
"Read my other post with code, I'm grabbing the value correctly" Don't worry about TimeTicks, he posts stuff without understanding it very well. I thought he used to do better. Maybe it was just me. Maybe he gave his account away. Who even knows?
I don't see a problem. If there's no output, then it's a logic error. I don't know how to solve this, I've looked through the code you posted. :c |
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 05:50 AM |
Eugh. Changing it all from (HairColor.Value) to "Bright red" doesn't even do anything. I'll prob necrobump when I get home later if I don't find a solution >.>
|
|
|
| Report Abuse |
|
|
Silicti
|
  |
| Joined: 07 Nov 2012 |
| Total Posts: 8242 |
|
|
| 26 Apr 2016 07:22 AM |
i dont think you can use stringvalues as brickcolors
i could be wrong |
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 07:53 AM |
local Color = Instance.new("BrickColorValue") --you had "String Value" before, it's called "StringValue" with no space
Color.Value = "Bright green"
game.Workspace.Part.BrickColor = Color.Value
|
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 09:47 PM |
You can if you do BrickColor.new(stringvalue) like I did...
"@The_Ben No. In the character customization when it adds/removes hats and colors them it works fine. But that's in a localscript. I'm doing all this from a serverscript which is apparently causing problems but when I manually change BrickColor from server log it will change it" [2]
|
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 26 Apr 2016 09:59 PM |
Do you really need this? They are workarounds that aren't' the best but work. You could use the workaround until you find a good solution.
For example
If Color.Value == "Red" then Hair.BrickColor = BrickColor.new("ActualBrickColor") end |
|
|
| Report Abuse |
|
|
|
| 26 Apr 2016 10:00 PM |
I'd have to account for like 32 colors but like I said even when setting the brickcolor directly like
"Changing it all from (HairColor.Value) to "Bright red" doesn't even do anything"
it didn't work
|
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 26 Apr 2016 10:02 PM |
| Oh that's strange. Is it only for that Part/Hair, have you tried it on other bricks? Might be a mesh problem |
|
|
| Report Abuse |
|
|