GetPartsInPart doesn't seem to detect trussParts

  1. What do you want to achieve? Keep it simple and clear!
    I need detecting truss parts and making them black and unanchored(like acid water which destroy parts), i use raycasting for this, baseParts get detected normally by this function, but it’s not detecting trussParts
  2. What is the issue? Include screenshots / videos if possible!
    image
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tryed to look to check about why it’s not detected, but zero info

Code

while task.wait(0.1) do
	if script.Parent.IfAcid.Value == true then
	local params = OverlapParams.new()

	params.FilterDescendantsInstances = {script.Parent, workspace.Baseplate}
		params.FilterType = Enum.RaycastFilterType.Exclude

	for _, part in workspace:GetPartsInPart(script.Parent, params) do
		part.Color = Color3.new(0, 0, 0)
		part.Anchored = false
		end
	end
end

maybe use region3’s?

Well i’m not really good with region3, so i fairly used raycast

region3 isnt that hard honestly just go read the documentation and tell me what happens after that.

Well as i checked few posts region3 is deprecated and better to use getpartBoundsInBox. I used it and first of all my water get unanchored itself and also it cause huge lags
code

while task.wait(0.1) do
	if script.Parent.IfAcid.Value == true then
	local overlapping = workspace:GetPartBoundsInBox(script.Parent.CFrame, script.Parent.Size*Vector3.new(1.25,1.25,1.25))
		for _, part in pairs(overlapping) do
			if part.Name ~= "Baseplate" and part.Name ~= "Capsule" and part.Name ~= "Base" and part.Name ~= "LightEmitter" then
				part.Color = Color3.new(0, 0, 0)
				part.Reflectance = 0
				part.Anchored = false
			end
			end
	end
end

EDIT: But this one finally detect truss parts

EDIT2: Ok nvm issue of lags was unanchoring water part itself, but for some reason now few parts what are a lot higher than a sea get unanchored and changing color.

For whitelisting just use a table instead of such a long if statement. And I also don’t understand what you mean.

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