So, I’m trying to detect parts with a specific name with
workspace:GetPartsInPart()
but so far, no idea. I know its probably supposed to do with overlapparams but I’m not exactly sure how I would use that.
So, I’m trying to detect parts with a specific name with
workspace:GetPartsInPart()
but so far, no idea. I know its probably supposed to do with overlapparams but I’m not exactly sure how I would use that.
OverlapParams.new(--put here you parts you want to ingnore--)
If you haven’t done so already you should read these two first:
Here’s an example on how to use them:
local YourPart = ...
local Params = OverlapParams.new()
Params.MaxParts = 10 -- if you only want 10 parts to be put in the ArrayOfParts
local ArrayOfParts = workspace:GetPartsInPart(YourPart)
for Index, Value in ArrayOfParts do
print(Value:GetFullName())
end
Try something like this:
local Part = game.Workspace.Part --put here your part
workspace:GetPartsInPart(Part,OverlapParams.new(game.Workspace.Part,game.Workspace.Part2))--put into brackets in OverlapParams.new() parts you want to ignore, if you want you can just use nil
Would this work if I wanted to ignore, say, a table of parts using table.unpack()?
Yes I think.
workspace:GetPartsInPart(script.Parent,OverlapParams.new({table.unpack(tab)}))
like this for example
Yes, try like this.
It didnt work, it still detects other parts other than the specified ones.
Did you even read the documentation of OverlapParams? The operator function does not take any arguments.
If you want it to not detect specific parts, you’ll have to do something like:
local PartsToIgnore = {} -- put your parts here
local ArrayOfParts = workspace:GetPartsInPart(YourPart)
for Index, Value in ArrayOfParts do
if table.find(PartsToIgnore, Value) then continue end
print(Value)
end
Again read the documentation of both if you really want to use OverlapParams.
Sorry,no.I just thinked that it works, cuz i saw that it didn’t print names of parts which i get in this table.
But it was cuz it was part which i used. Sorry for this, but i think i know how it works now. @lor5s idk if you still need solution, as @ObviouslyGreen already gave you script which works too, but if yes then i know how to make it without checking if part = part in table in your loop, so here is script:
local Part = game.Workspace.Part --put here your part
local Something = OverlapParams.new()
Something.FilterType = Enum.RaycastFilterType.Exclude
Something.FilterDescendantsInstances = -- put here table with parts you want to ignore
workspace:GetPartsInPart(Part,Something)