Why is it not changing the text of the textlabel "ObjectName" to the string attribute value

i want it to show the value of the attribute as the text
but it keeps saying attempt to index nil with ‘Value’


pad.PrimaryPart.BillboardGui.ObjectName.Text = pad:GetAttribute("ObjectName").Value

this attribute is inside every pad
image

Remove .Value

pad:GetAttribute("ObjectName") should return “Wall 2” by itself, .Value is a non-existent property of it.

I should add it may be possible you’re reading the attribute before it has been set, make sure to double check.

1 Like

thank you i didnt know that. Are string values the only one that dont require .Value

I think you may have confused properties and instances.

If you were storing ObjectName as a StringValue Instance, you’d have to get the instance, and then read the .Value property of that Instance, like: game.Workspace.ObjectName.Value

Remember that ObjectName in this example is an Instance (which is similar to “object” data types in other programming languages)

Instances have things called Properties, which describe them. Which would be “.Value” in this example.

GetAttribute/SetAttribute is simply a way of assigning custom properties using Roblox’s instance structure. Althought they cannot be read using .ObjectName and must be read using :GetAttribute("ObjectName") which would act just like .Value in this case.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.