I want to be able to detect if a part is able to be pushed around, aka a part that is not anchored and not welded to an anchored part. I need to do this so I can add these parts to my ignore list in my anti-noclip script. I want unanchored parts that are welded to each other (they can still move) to be ignored, but I want immovable parts (unanchored parts welded to anchored parts) to not be ignored. Is this possible? (Also, I’ve tried checking to see if Velocity.Magnitude>0, that doesn’t work. Physics of the part are updated on the client before they are on the server.)
local function is_movable(part)
return #part:GetJoints() == 0 and not part.Anchored
end
There you go. When you weld a part to another it will create a joint, so part:GetJoints()
would return the table of those joints, so if its length 0 it isn’t connected to anything, and of course if it’s not anchored it can move.
2 Likes
This works if there is no weld in the unanchored part?
There would be a joint created when it is welded, if it isn’t welded to anything there is no joints
1 Like
There is just one issue with checking for joints.
An unanchored part welded to another unanchored part is not ignored since it has joints.
part:IsGrounded() will return if the part is anchored or attached to solid assembly that is anchored.
IsGrounded
10 Likes
Using
if part:IsGrounded()==false then
works perfectly. You saved the day.
1 Like