Ad
Log in to vote
0

How to convert ObjectValue into string?

Asked by 10 days ago

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

Log in to vote
0
Answered by
incapaz 5465 Moderation Voter
10 days ago
Edited 10 days ago

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.

Ad

Answer this question