Do bindables send the actual reference to a table, or just a "deep copy"?

I was making an inventory system, and it has a custom event that uses bindables to work. The event is “itemSelected.” When an item is selected, I store it, and when another is selected, the two items switch spots. The problem I’m having is that it seems like the item that’s sent on the “itemSelected” event isn’t the exact one that is actually selected. (These “items” are custom objects btw. They’re just tables with all the properties and methods necessary to work in my inventory system. They’re created with an “addItem” method of the inventory)

Problem I’m having is that when the custom destroy method is called on an item, it removes all the necessary UIs and stuff, but it seems like if it was referenced when the itemSelected event was fired, it still has all the UIs. On destroy, the gui is destroyed, and item.gui is set to nil. However, if there was a reference of a removed item, item.gui still exists and isn’t destroyed. Just want to know if a bindable is supposed to send the actual reference to a table or if it’s just a deep copy, which would make sense and kinda explain what’s happening.

Hopefully this post helps:

Yea that addresses my issue. I’ll just get around it by sending the position of the item in the inventory and the script can get the actual reference by looking in the module.

1 Like