Hi,
Quick question can i change parent of an object if im accessing object from object value?
No values won’t work it will say something like
Error line1: parent is not a child of Value
Yes you can. An ObjectValue holds a reference to an instance, so accessing the value retrieves a reference to that instance. Value.Parent is valid for an ObjectValue. @crunchbone Please test and do some research before replying!
local Part = Instance.new("Part")
local ObjectValue = Instance.new("ObjectValue")
ObjectValue.Value = Part -- Value is now a reference to part
ObjectValue.Value.Parent = workspace
thanks! also can i access a childrens of the part using objectvalue?
Yes.
The ObjectValue itself is still a ValueObject like any other, so you can keep references to it… If you access the Value however, you’re now creating a reference to the same instance that ObjectValue is holding a reference to.
Say for example your ObjectValue’s Value was a Player character. Once you access value, you’re now looking at the character. So if you wanted to find a Humanoid, for example, this is valid:
ObjectValue.Value:FindFirstChild("Humanoid")