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
What is the issue? Include screenshots / videos if possible!
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
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.