So I’m generating a path (version 2 now), and I have it so when trying to generate, it checks 3 blocks in front of the last one generated, if the first one is blocked, it just breaks, and moves to the next point, if the second is blocked, but the first and third are clear, it bridges over(if it isnt a bridge at 2), and it only bothers with the third check if the second is blocked, but for some reason it starts just randomly bridging, and goes through other pathways
robloxapp-20220513-0929141.wmv (2.1 MB)
This video shows the issue, it just randomly starts bridging, and I have no idea why it would start doing that, I checked the scaling, and it should be fine I use
module.IsBlocked = function(obj: Model)
local place = obj or LastPlace
if not place or not place:FindFirstChild("Front") then return end
overlap.FilterDescendantsInstances = {place}
local parts
local first, second, third
parts = workspace:GetPartsInPart(place.Front, overlap)
if parts then
for i, v in pairs(parts) do
if v:IsDescendantOf(workspace.Paths) and v.Name == "Base" then
first = true
break
end
end
end
if first then
module.PlacePortal(obj)
return
end
parts = workspace:GetPartBoundsInBox(place.Front.CFrame * CFrame.new(0,0, -size * 1.75), Vector3.new(size,1,size), overlap)
if parts then
for i, v in pairs(parts) do
if v:IsDescendantOf(workspace.Paths) and v.Name == "Base" and not v:FindFirstChild("Bridge") then
second = true
break
end
end
end
if second then
parts = workspace:GetPartBoundsInBox(place.Front.CFrame * CFrame.new(0,0, -size * 2.75), Vector3.new(size,1,size), overlap)
if parts then
for i, v in pairs(parts) do
if v:IsDescendantOf(workspace.Paths) and v.Name == "Base" then
third = true
break
end
end
end
end
if second and not third then
module.PlaceBridge()
end
end
I don’t get any errors, and as far as i can tell it should work, anyone know either a way to solve this(using my current system) or a smarter method to check this?
Edit : I tried using gyazo for the video, but I was lazy to re-do the video, so used the one I already had