if I have a part and I move it to a second part, it goes on top of the second part. How do I make it so that it does collide with the second part? Do I turn of Can collide when I move it?
How do I move a part without it colliding with other parts?
3 answers
To do this you would use the CFrame property of the part you are trying to move. Unlike Position/ Orientation/ Velocity , which take collisions into account when a part has its canCollide property set to true, CFrames don't do this, which makes them excellent for moving, things without toggling its canCollide Property.
To Construct a cframe you would do the following:
local cfm = CFrame.new(...)
There are many different ways of constructing a CFrame matrix, but the simplest is just constructing and filling out its Position matrix like such:
local cfm = Cframe.new(Position)
With this , you can move parts around like such:
local part = workspace.Part
local DesiredPos = Vector3.new(67,14,12)
part.CFrame = CFrame.new(DesiredPos)
- Note that doing this would reset the rotations performed on the part.
Hopefully this helped you out!
I'm not entirely sure if that's a scripting question, but if you're trying to manipulate parts in studio, there is a button that you can toggle to allow parts to move through each other.
If you're talking about scripting, there is nothing preventing the parts from moving through each other unless you intentionally change something.
2 comments
On your 2nd statement, setting the position of a part inside of another would cause the part to get moved to the top. This has been something in Roblox for a long time now. This is where you would use CFrames.
Small explanation of it in this: https://devforum.roblox.com/t/feedback-on-potential-removal-of-safe-move-when-setting-position-orientation-from-lua/92913
Yes, you can turn of Can collide, but I think if you are moving parts with script, it doesn't get on the top of any other parts/models. You can also turn off Can collide with a script, for example:
workspace.Part.CanCollide = false --or workspace.Part.CanCollide = 0
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Turning off CanCollide means that the parts WONT Collide AKA will go through each other.