From 04d6483167cf2510688de4a5409b8c9ab26ce2f9 Mon Sep 17 00:00:00 2001 From: 1ForeverHD Date: Sat, 28 Aug 2021 12:33:15 +0100 Subject: [PATCH] Fixed hrp is nil bug --- docs/changelog.md | 3 +++ src/Zone/ZoneController/init.lua | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 636a182..9c0f465 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -15,6 +15,9 @@ - ``Zone.new(zoneGroup)`` to ``Zone.new(container)`` - ``zone.group`` property to ``zone.container`` +### Fixed +- "ZoneController hrp is nil" bug + -------- diff --git a/src/Zone/ZoneController/init.lua b/src/Zone/ZoneController/init.lua index 2fff594..0158ea2 100644 --- a/src/Zone/ZoneController/init.lua +++ b/src/Zone/ZoneController/init.lua @@ -391,9 +391,10 @@ function ZoneController.getTouchingZones(item, onlyActiveZones, recommendedDetec bodyPartsToCheck = item:GetChildren() else local hrp = item:FindFirstChild("HumanoidRootPart") - local hrpCFrame = hrp and hrp.CFrame - itemSize, itemCFrame = hrp.Size, hrpCFrame - table.insert(bodyPartsToCheck, hrp) + if hrp then + itemSize, itemCFrame = hrp.Size, hrp.CFrame + table.insert(bodyPartsToCheck, hrp) + end end if not itemSize or not itemCFrame then return {} end