GetAttribute returns nill but GetAttributes[""] works

I’m making a script that checks what parts should have the skin on, and who said parts belongs to, to get the skin the player has equipped.

but when I try to get the skin the Player has equipped via GetAttribute("EquippedSkin")
it just returns nil, but when I do Owner:GetAttributes().EquippedSkin it works normally.

does anyone know what is causing this problem?
There’s nothing in the output, and yes it happens in game too not just studio.

I have checked for any typo many times and I have even tried retyping the whole thing again and it still returns nil. I’ll use the latter method for now but if theres a way to fix this then I’d much rather use GetAttribute, thank you for your time.

Edit. Owner:GetAttributes().EquippedSkin won’t work either now that also returns nill.
Edit2. Both works when I use them in Print()

1 Like

The attribute is probably being created after this code is ran.

Also, in the snippet you code you showed, you never really do print(Skin) or print(GetAttribute("EquippedSkin")), though that doesn’t mean it’s the problem.

I tried the print(Skin) and it worked fine… I am really stupid I’m sorry
apparently the Skin variable was turned to nil by some codes after that code

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