Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/Zone/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down