Currently, I am attempting to capture the FontType of a text label inside of a value, which is also inside of that textbox.
I was wondering if there's a way I can do this without error. My code is posted below, as well as a hierarchy of how the text label is in reference to the value and the script itself.
>>Textlabel >>Value >>Script
while true do wait(0) script.Parent.Value = script.Parent.Parent.Font end
Well, to start, you're trying to set a StringValue
to an Enum
value. To fix this, use tostring()
:
script.Parent.Value=tostring(script.Parent.Parent.Font)
However, this includes the "Enum.Font." part of the text, and we probably don't want this. To get rid of it, use a string.sub()
that starts at the 11th character:
script.Parent.Value=string.sub(tostring(script.Parent.Parent.Font),11)
I hope this helped!