what i want to do is make a mining system that is realistic
i want it to do is
local targetsandtheirhealth = {
[5] = "Brick" -- Brick is object and [5] is the health of the object
}
table.insert(targetsandtheirhealth,#targetsandtheirhealth+1,[target.Parent.Health] = target)
tall get the idea right so is that possible ? if not is there a alternative to it?
using health as index isnt really a good idea but if u wanted to stick to it instead of doing table.insert you should do mytable[health] = “Brick”
you could make it better by making the index the targets name/target itself and assigning it another dictionary or a table which contains the object and health
local targetDictionary = {
["PlayerName"] = {Object = "Brick", Health = 5}
}
local health = targetDictionary.PlayerName.Health
local object = targetDictionary.PlayerName.Object