From 175abeaf63cb2d6a4d7893192d0da4263c17a498 Mon Sep 17 00:00:00 2001 From: Sluethen Date: Thu, 22 Feb 2024 19:52:49 -0700 Subject: [PATCH] Closes #47 --- src/Zone/init.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Zone/init.lua b/src/Zone/init.lua index 62de930..eea05f7 100644 --- a/src/Zone/init.lua +++ b/src/Zone/init.lua @@ -789,16 +789,32 @@ function Zone:unbindFromGroup() end end -function Zone:relocate() +function Zone:relocate(newParent: Instance?) if self.hasRelocated then return end + if newParent then + self.worldModel = newParent + self.hasRelocated = true + + local relocationContainer = self.container + if typeof(relocationContainer) == "table" then + relocationContainer = Instance.new("Folder") + for _, zonePart in pairs(self.zoneParts) do + zonePart.Parent = relocationContainer + end + relocationContainer.Parent = newParent + end + + return + end + local CollectiveWorldModel = require(collectiveWorldModelModule) local worldModel = CollectiveWorldModel.setupWorldModel(self) self.worldModel = worldModel self.hasRelocated = true - + local relocationContainer = self.container if typeof(relocationContainer) == "table" then relocationContainer = Instance.new("Folder")