From 1b1ef0d647f9baae9adfc0b23f8bd642193af12e Mon Sep 17 00:00:00 2001 From: fe1ip <158541244+fe1ip@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:44:31 -0400 Subject: [PATCH] chest-destroy-function --- .../fundamentals/coding-6/create-with-module-scripts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en-us/tutorials/fundamentals/coding-6/create-with-module-scripts.md b/content/en-us/tutorials/fundamentals/coding-6/create-with-module-scripts.md index 5ad1e33b6..67e101755 100644 --- a/content/en-us/tutorials/fundamentals/coding-6/create-with-module-scripts.md +++ b/content/en-us/tutorials/fundamentals/coding-6/create-with-module-scripts.md @@ -332,7 +332,7 @@ So the player can open a chest, create a function in **TreasureManager** that aw local playerTreasure = getPlayerTreasure(whichCharacter) playerKeys.Value = playerKeys.Value - chestPickCost playerTreasure.Value = playerTreasure.Value + chestReward - chestPart:Destroy() + chestPart.Parent:Destroy() end ``` @@ -479,7 +479,7 @@ end -- Binds every chest part to the touch function so it works on all parts for chestIndex = 1, #chestsArray do - local chestPart = chestsArray[chestIndex] + local chestPart = chestsArray[chestIndex]:WaitForChild("Collider") chestPart.Touched:Connect(function(otherPart) partTouched(otherPart, chestPart) end)