[Part].Touched doesn't work with resize

I’m trying to update a large number of parts by resizing a sphere and using a .Touched function to detect when the sphere has reached the part.

Apparently, .Touched does not work when resizing a part. It will not detect it. Is this a bug? Alternatives to doing this?

Its probably due to,when an part is resized,it isnt able to touch anything,but after stopping it,it may be touchable once again.(You can probably see this on building type of games.)

Well here is my sloppy temp code using a for loop, so it should ‘stop’ and then continue…?

for i = MS.Value, 0, -0.01 do
    ES.Size = ES.Size + Vector3.new(0.1, 0.1, 0.1)
    wait()
end

I see your point though.

Sorry,i didnt learn about for loops yet,i still hope my post above helps you…

“This event only fires as a result of physics movement, so it will not fire if the CFrame property was changed such that the part overlaps another part. This also means that at least one of the parts involved must not be BasePart.Anchored at the time of the collision.”

I’ll mark that as the solution but do you have a fix or alternative?

We aren’t 100% sure what you are trying to achieve, but the best thing to do would be to calculate the end size of the sphere before resizing it. You can raycast from the center of the sphere to get a final radius.

It depends what you want to achieve. For example you can loop through all the parts and check if their position satisfies the condition
(x - x0)^2 + (y - y0)^2 + (z - z0)^2 <= R^2
where x, y, z is the position of the part, x0, y0, z0 is the center of the sphere and R is the radius of the sphere.

function IsInSphere(x0, y0, z0, R, part)
    return (part.Position.X - x0)^2 + (part.Position.Y - y0)^2 + (part.Position.Z - z0)^2 <= R^2
end

This will return true if the part’s center is inside of the sphere and false if not.

What about part creation? It won’t detect that either.

I don’t understand what you mean.