What do you want to achieve? Keep it simple and clear!
So topic explains everything.
What is the issue? Include screenshots / videos if possible!
Issue is what waterPart is anchored itself(and anchored part can’t touch anchored part) and if i use weld constraint it still don’t detect anchored parts, only unanchored one.
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I’ve tryed weld constraint also checking few posts
Curr Code:
script.Parent.Touched:Connect(function(hit)
...
if script.Parent.IfAcid.Value == true then
if hit:IsA("BasePart") or hit:IsA("Part") or hit:IsA("MeshPart") then
hit.Color = Color3.new(0, 0, 0)
hit.Anchored = false
end
end
end)
The Touched event fires only if one of the parts is unanchored. So you can try something like this:
while task.wait(0.1) do
local params = OverlapParams.new()
params.FilterDescendantsInstances = {script.Parent}
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
Well that would work and i was thinking about this, but wouldn’t checking every single part in workspace will cause a lot of lag issue with check each 0.1s
Well if you’re concerned about lag, then you could try:
local function CheckParts(params)
for _, part in workspace:GetPartsInPart(script.Parent, params) do
if part.Anchored == true then
part.Color = Color3.new(0, 0, 0)
part.Anchored = false
break
end
end
end)
while task.wait(1) do
local params = OverlapParams.new()
params.FilterDescendantsInstances = {script.Parent}
params.FilterType = Enum.RaycastFilterType.Exclude
CheckParts(params)
end
Well Yeah increasing time per part is good, but i still want parts to quickly unanchor. Also my opinion about lags was right. I got like 15 fps after acid water started to work