Stick two parts together

Hello! So, I wanted to make something where some surface of one part “sticks” to a surface of another part. Basically, if the top surface of part1 stuck to the bottom of part2, then every time part1 is moved, part2 should automatically move with it (same goes for rotation). I have tried using welds and weldconstraints but neither are working. It might be because I’m not putting them properly, but I have no idea on what to do. Any help would be appreciated! Thank you!

weld constraints or welds are the way to go. With a weld constraint
(which is just a weld but not deprecated),
(I was corrected, they are not deprecated, they just aren’t as favorable)

set the weldconstraint part1 an part0 properties to weld the parts. You can (and probably should) parent it to one of the parts, but I don’t think this is required.

1 Like

Thanks! I have tried experimenting with this but I’m not sure if I’m doing it right. I made a small square part called “Center” and a big rectangular part called “Part” touching it. I added a weld constraint with the part0 to be Center and part1 to be Part (other way around too), but every time I tween the orientation of either of the parts, the other doesn’t rotate along with it.

I haven’t tried using them with with tweenservice, but I have teleported them without issue. Maybe try moving it with a bodymover?

1 Like

Sorry for a double response. I found this: Weld constraints not working with tween
Try motor6 or unanchor the welded part (thats not being tweened)

1 Like

Thanks! I’ll try searching up on body gyros and movers now!

1 Like

Welds are not deprecated. Nada. Nope. They’re just not favored to use.
I don’t see no deprecation


Example of a deprecation:

WeldConstraints are easier to use to make a “join in place” kind of weld. But Welds are more customizable, and can be used for complex things like animation. But for general use like joining things together, WeldConstraints are easier and better to use.

2 Likes

Wow! I have no idea why I thought they were deprecated. Thanks for the clarification.

2 Likes

I’m going to try using a motor 6D now. Thank you!

It’s going to do the exact same thing as welding. But if you insist, try this:
local p0 = --Part0; local Part1 = --Part1; local M6D = Instance.new("Motor6D", p0) M6D.Part0 = p0; M6D.Part1 = p1; M6D.C0 = M6D.C0:ToObjectSpace(Part1.CFrame) -- if doesn't work, try replacing with ToObjectSpace(C1)

1 Like

Unless I’m forgetting the main point here, I’m pretty sure you can select all the parts and then go to model and click union.

Tell me if this works

1 Like

Well yes, but if he’s using any kind of meshes, It wouldn’t work. So reserve that for part-modelled things.

1 Like

Motor6D’s don’t work either. Every time I put in a motor 6d or a weld constraint, the part named “center” moves inside of the main part and the tween doesn’t work.

I made a code block on how you can join in place with a Motor6D.

This is it beautified:

local Part0, Part1 = part0thing, part1thing
local M6D = Instance.new'Motor6D'
M6D.Parent = Part0
M6D.Part0 = Part0
M6D.Part1 = Part1
M6D.C0 = M6D.C0:ToObjectSpace(Part1.CFrame)
1 Like

Yeah, I kind of over looked that at the moment

1 Like

This would work, but that’s not the current problem I’m facing. My problem right now is that I’m trying to make a gate crossing that will come down and close like in this video:

but if I try and tween the orientation of the main gate itself, it rotates it using the center of the part and comes out floating. If possible does anyone know how to make a script that accomplishes this tween? I wanted to know how to stick two parts together as, if I tweened one of the parts, the other would move along with it and wouldn’t rotate from the center of it. If possible could anyone tell me a script to actually do the tween if the “sticking” thing I suggested isn’t possible.

PS: If you look at the video, I basically wanted to put the “Center” part on the screw place of the gate, that way, when the center moves, the entire gate moves

Make a hinge part at the start, weld in place, then tween the C0 of the weld for it to rotate. Example: My oven model, playtest and click on it (look in the tween inside the main script.) The whole lid is only one part, but it rotates on a hinge
https://www.roblox.com/library/6504269453/Oven-Stove-scripted

I literally had to make an api request to get my userid from my username to go into my inventory to get this model because I’m banned for 3 days for saying "I’ll show you de way’. yAAYyyYY!!!

1 Like

I will take a look at it right away. Thank you so much!

Sorry about your ban :sad:

1 Like

It is quite a lot of code. I wasn’t able to understand most of it. I don’t need any effects or anything but could you explain how the thing actually works as I don’t even understand what the partc0 does. Thank you!

Could you paste the code in as i’m banned and can’t use studio :frowning: (That’s why i’m on devforums helping people because bored)
Thanks

1 Like