Adding more items to a table?

  1. I want to make a script that, when given a vector3 position value, it would record the item it originated from, or if it had already been recorded before it would return the item that was recorded along with the vector3

  2. Making a table/dictionary with the values from the very beginning works, but I have to add them as I go and have not been able to, I did find a few similar posts but they didn’t seem to have a solution that worked either, unless I didn’t catch it

local Dictionary = {[Vector3.new(0,12,5)] = game.Workspace.zombiespawn}

print(Dictionary[Vector3.new(0,12,5)]) -- prints zombiespawn

  1. I think I did find a way that involved adding new dictionaries to a table but instead of being able to search for the vector3 directly, it required looping through each item’s position in the list. Is there simpler way to add another vector3 and instance to the original table? or at least make a new one with the old contents

You just do Dictionary[Vector3] = instance

I SWEAR I tried that
oh well I can finally sleep calmly again, at least until the next time I find something else to get annoyed over

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