I am trying to create a box based(the region3 replacement) loading system. The problem is that the bounds dosnt detect the player, and dosnt load the area. I am using a custom character, aka the character is skinned. Here is my current code:
local loaded = script.Parent.traverseloads
local chapter = game.ServerStorage.Chapters:WaitForChild(script.Parent:GetAttribute("chapterlinked"))
local unloaded = chapter:WaitForChild("traverserooms"):Clone()
unloaded.Name = "unloadedtraverse"
unloaded.Parent = game:GetService("ServerStorage")
local bounds = chapter.traversebounds
local RunService = game:GetService("RunService")
local Character = game.ServerStorage:WaitForChild("Character").Value
for i,v in pairs(unloaded:GetChildren()) do
for _i,boundfolder in pairs(chapter.traversebounds:GetChildren()) do
if v.Name == boundfolder.Name then
RunService.Heartbeat:Connect(function()
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {Character.PrimaryPart}
local objects = workspace:GetPartBoundsInBox(boundfolder.load.Position.Value,boundfolder.load.Size.Value)
print(#objects)
if #objects > 0 then
v.Parent = loaded
else
v.Parent = unloaded
end
end)
end
end
end
And here is my current Characters decendants:
Thanks!