Can I make a custom "property"/attribute without using value objects?

Hello!

Basically, I am trying to make a custom interact system, however I want to use a table to handle all of the parts that can be interacted with, and I want to make a debounce. The problem is that I’m not sure how to make an effective debounce for an array of items.

I want to do something like Part.InteractVisible = true but this property doesn’t exist, and I’m not sure how to give it custom attributes like that, or even if it’s possible.

local PromptParts = {
    workspace:WaitForChild('Boardwalk').CoinStand.Coin;
    workspace:WaitForChild('Boardwalk').ShopStand.Shop;
}

for i,v in pairs(PromptParts) do
    v.InteractVisible = false
end
1 Like

I just make a folder with the name of the player parented to a stand when they interact. Then, I use the Debris service to remove it after some time.

2 Likes

This is a local script, each interaction is being cloned from ReplicatedStorage, then parented to the part and tweened accordingly. I think your solution would make it server-sided which I want to avoid. I also want the player to be able to interact for as long as they’re within the interaction range (which is 20 studs or something)

1 Like

If I understood it right, CollectionService is probably the best option.

1 Like

Wait, are you talking about this?

2 Likes

I’m not really sure, I just wanted to add a custom “property” to a part that can be either true or false, and the property name would be “InteractVisible” which means the object is currently interact-able. Think CollectionService would work though, and I could use .TagAdded or whatever.

1 Like

Alright, but are you going to add and remove the tag? If so, I think it actually works.

1 Like

Yep! That should work, adding and removing the tag from each of the parts.

Do you know how I would find out which part was removed? Is it just passed as an argument in the function that the signal connects to?

1 Like

You can use:

collectionService:GetInstanceRemovedSignal('Tag Name'):Connect(function(object)
	print(object.Name .. ' was removed.')
end)
1 Like