Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to convert ObjectValue into string?

I'm trying to get the name of the object but I need to convert it into a string to do so.

local objectvalue = script.Parent.Parent.Parent.Parent.ObjectValue
local pstring = tostring(objectvalue.Value)
print(pstring)

This code just prints out nil (I need it to print out the value name). How would I be able to get the name of the value stored inside of the ObjectValue?

1 answer

✓ Accepted answer

###You can't directly set the Value of the ObjectValue to a string, it will always hold an Instance, unless you set the Value of the ObjectValue to nil. You can tostring the object and store it in a variable, but that's about it. If you really wanted to hold a string, use a StringValue, Whenever you assign the Value, assign it the name of the object instead.

This discussion is preserved as it was. New answers, comments, and votes are closed.