why isnt the second chest opening?
01 | local Chests = { game.Workspace.Chests.Chest 1 , game.Workspace.Chests.Chest 2 } |
02 | local OpenChests = { game.ServerStorage.Chests.Game.OpenChest 1 , game.ServerStorage.Chests.Game.OpenChest 1 } |
03 |
04 | Chests [ 1 ] .KeyHole.ClickDetector.MouseClick:Connect( function () |
05 | Chests [ 1 ] :Destroy() |
06 | OpenChests [ 1 ] :Clone().Parent = game.Workspace |
07 | table.remove(Chests, 1 ) |
08 | table.remove(OpenChests, 1 ) |
09 | print (Chests [ 1 ] ) |
10 | end ) |
1 | local OpenChests = { game.ServerStorage.Chests.Game.OpenChest 1 , game.ServerStorage.Chests.Game.OpenChest 1 } |
Chest2 is not within your OpenChest table
1 | Chests [ 1 ] .KeyHole.ClickDetector.MouseClick:Connect( function () |
2 | Chests [ 1 ] :Destroy() |
Furthermore, you are only listening for the keyhole of the first chest to be clicked, of which is automatically disconnected once it's opened since you destroy the object anyway.