Skip to content

Commit

Permalink
Fixed hrp is nil bug
Browse files Browse the repository at this point in the history
  • Loading branch information
1ForeverHD committed Aug 28, 2021
1 parent 9e7cc4b commit 04d6483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
- ``Zone.new(zoneGroup)`` to ``Zone.new(container)``
- ``zone.group`` property to ``zone.container``

### Fixed
- "ZoneController hrp is nil" bug



--------
Expand Down
7 changes: 4 additions & 3 deletions src/Zone/ZoneController/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 04d6483

Please sign in to comment.