Howdy, I am going to jump straight to the point.
I am attempting to use PasteRegion but it doesnt work when embedded into a if statement but the rest of the if statement executes, just specifically the PasteRegion doesnt.
Heres the code, you can see I have the if statement that breaks it commented out. If I uncomment the if statement then the pasteregion will stop executing but the rest of the if statement still works. This seems like an internal error.
for Index, Object in ipairs(TerrainChunks) do
--if #workspace:FindPartsInRegion3WithWhiteList(Object[2], {TreasureBreadcrumb}, math.huge) > 0 then
if #workspace:FindPartsInRegion3WithWhiteList(Object[2], ChestWhitelist, math.huge) == 0 then
print(1)
workspace.Terrain:PasteRegion(Object[3], Object[1].Min, true)
print(2)
for Index1, Object1 in pairs(workspace:FindPartsInRegion3WithWhiteList(Object[2], PlayerWhitelist, math.huge)) do
if Object1.Name == "HumanoidRootPart" then
spawn(function()
repeat
Object1.Parent:MoveTo(Object1.Position)
wait()
until
Object1.Parent.Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall
end)
end
end
end
--end
end
It also prints the 1 and the 2. I think paste region is throwing a silent error. I cant veiw silent errors so I am like 90% sure this is a internal bug, but It may not be so if anyone has any ideas please let me know!
EDIT: Maybe its because I am using Ipairs?