I'm using prints to check what's going wrong in the script, and it only prints 1 and 3 in the output so obviously the script is thinking the ore is a part of the table, when as you can see, it clearly is not. I really need help with this, as I've been asking this for over a day now.
Here is the output.
local done = {} script.Parent.Touched:connect(function(p) if p:FindFirstChild('oretag') then if p:FindFirstChild("Shinifier").Value < p:FindFirstChild("ShinifierL").Value then print("1") local canbeupgraded = false for _, value in pairs(done) do if p == value then canbeupgraded = false else canbeupgraded = true print("2") end end print('3') if canbeupgraded == true then p.money.Value = p.money.Value + script.Parent.Upgrade.Value table.insert(done, #done + 1, p) p:FindFirstChild("Shinifier").Value = p:FindFirstChild("Shinifier").Value + 1 print('4') canbeupgraded = false end canbeupgraded = false else script.Parent.BrickColor = BrickColor.new("Bright red") wait(0.1) script.Parent.BrickColor = BrickColor.new("CGA brown") end end end)