:IntersectAsync() not working well?

  1. What do you want to achieve? Keep it simple and clear!
    Im trying to make parts to be fit into an area

  2. What is the issue? Include screenshots / videos if possible!
    The :IntersectAsync() doesn’t work how it should

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Leaving CSG Version 3 beta and joining again, searching on devforum and reinstalling studio

		for _,v: Part in ipairs(f:GetChildren()) do
			if v:IsA("BasePart") == true and v:IsA("UnionOperation") == false and v:IsA("IntersectOperation") == false then
				pcall(function()
					local a = v:IntersectAsync({v, template})
					if a then
						a.Parent = f
						v:Destroy()
					end
				end)
			end
		end

f → model with all the parts
template → zone I want to “cut out” (the area I want the parts to fit in)

Video:

It seems like the issue lies in the usage of :IntersectAsync() function. To ensure that :IntersectAsync() works as expected, it is important that the two parts passed as arguments to this function are in the same coordinate system and are both BaseParts. If one of the parts is not a BasePart, then :IntersectAsync() may not function as expected.

You may want to double-check that the template variable is initialized correctly and that it is actually a BasePart. Additionally, you may want to consider using the :IntersectWith() function instead of :IntersectAsync(), as it is a synchronous function that could help with troubleshooting. If none of these solutions work, you may want to consider reaching out to the Roblox Developer Hub community for further assistance.

1 Like

Thanks for your response but testing with what you told me I found the mistake and it was here, the part was interseting with itself

local a = v:IntersectAsync({v, template})

so I just changed it to this and it worked

local a = v:IntersectAsync({template})

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.