Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do you convert a string to a BrickColor? [closed]

Asked by
Radstar1 270 Moderation Voter
7 years ago

Background: In my Character Creation I have a string value that store's the player BrickColor name.
Such as:

local StringValue.Value = "Really red"

Question: How do I go about converting that string value to an actual BrickColor. When the player joins their BrickColor's name is saved in the string, but I can't just say

Player.Character["Right Leg"].BrickColor = StringValue.Value

because it outputs: bad argument #3 to 'BrickColor' (BrickColor expected, got string)

Is there a way to convert this?

0
I'm going to moderate this as OT because you answered your own question. +1 for a good question, +1 on the answer so you don't lose rep from moderation. Goulstem 8144 — 7y

Closed as off-topic by Goulstem

This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
Radstar1 270 Moderation Voter
7 years ago

I figured out how to do it just convert the whole thing to a BrickColor.

So

Player.Character["Right Leg"].BrickColor = BrickColor.new(StringValue.Value)

Ad