Is It Possible to change an item based on an attribute?

I was wondering if it was possible to change an item based of an attribute.

For Example, I want to make the keycard change to model to a different keycard if the level is 2

image

The only way I could think of doing this (if its not already a feature) is by iterating through every part and checking if it has level x and if it does change the model correlating to the level. If you don’t understand let me explain it differently.

If I have a Keycard with the level 1, when I put it through a machine it add 1 to the level making it level 2. I want the model to change because its level 2, the reason for this is if I have a machine I don’t want to have to manually change level 1 - 2, level 2 - 3, level 3, 4, level 4 - 5 etc. This makes it extremely monotonous when adding more variants or different keycards and items.

Thank you and have a great day!

Attributes are basically custom properties. You can learn how to use them here Instance Attributes

use keycard:SetAttribute(“Level”, 2) to change the level.

As for changing the card itself I think it would be easier and much less of a hassle to use textures and assign a texture for each level (you could do a loop that checks the level and then change it accordingly)

2 Likes

Alright, I will try this in the future as I have found a different way.

1 Like