How to detect if basepart is being modified?

I am making a system that records the environment of a game. It uses FindPartsInRegion3 to detect and get baseparts. But it doesn’t detect decals, meshes, or welds that are manipulating the parts. How would I go on finding if a object is manipulating it? I already tried doing a giant scan but it gets lag heavy and scans to much.

Suggestion


You could use these following signals:

  • BasePart.ChildAdded or BasePart.DescendantAdded
  • BasePart.Changed
  • For specific property changes: BasePart:GetPropertyChangedSignal()

This doesn’t help me identify if a weld is acting on a part since a weld does not have to be a child of the part.

Then add .Changed on that object after it was added, using .DescendantAdded workspace.DescendantAdded.

I am not creating parts and adding welds. I am checking if there are any that already exist.

Probably workspace:GetDescendants() loop and checking whether the object found is a Decal, Weld or Mesh. Decals and meshes need to be parented directly to the part to actually apply any effects. Welds do not have to be parent of the object to weld between parts, and thus you have to check its C0 and C1 for the parts they are affecting.

One problem with writing that is finding the “collective” class for those objects. "Hidden" classes for objects' API is something I have requested earlier. I’d write the line of the if statement:

if v:IsA("Weld") or v:IsA("WeldConstraint") or v:IsA("SpecialMesh") or v:IsA("Decal") then

After getting the objects, use .Changed for each of them.

What exactly are you trying to achieve here by recording the environment of a game?

Are you trying to check if BaseParts have these as descendants? FindPartsInRegion3 obviously won’t find anything other than BaseParts. What exactly are you doing?

Are you looking for either GetJoints or GetConnectedParts?

2 Likes

I am trying to find a simpler then brute Force method to find it a part was being welded or manipulated by something like a weld which does not have to have the basepart as a parent.

I’m sure the first method I linked, GetJoints, should work then. It returns an array of all joints or constraints that the part is associated with. Give that a try and see if it accomplishes what you require.

I believe the functions you gave me will work. I didn’t know about them. I will go home and test them and then give correct answer to the response that works. Just give me a few hours. I am at school at the moment.

You mean Part0 and Part1, right? The C0 and C1 are just the offsets as far as I know.

2 Likes