How can I make these parts auto-weld?

Hi, I need help with my build tool.

Probably a stupid question, but im wondering how I can make these parts weld together when they are placed, just like they are auto welded when building in studio.

Does anyone know how to do this?

1 Like

Based on what you want to achieve couldn’t you just anchor the placed object? If I have the wrong idea could you clarify what you mean?

1 Like

No, because im trying to get them welded so that they can be destroyed by explosions, and I dont want to have a process of anchoring and then unanchoring.

1 Like

Could I use something like Region3 to get the closest block and then weld it to that?

Couldn’t you just weld the item to mouse.Target or the hit part of the ray?

Is your placement system node based (data structure wise)? If so it should be quite easy as you could just weld a node next to the node you’re placing the part, if another part is in that node. To clarify what I’ve just said exactly as it sounds confusing; if you had one part in node A and placed a part in node B while node B is next to A you could just weld them together and so on for every newly placed part.

1 Like

really you could add constraints to the Surfaces of each blocked placed

I dont quite understand, what do you mean?

Well, this is slightly off topic but the grid-like placing is all client-side and I think that could be screwed up by exploiters.

I believe he is referring to changing the Surfaces to Weld, but I believe you already do that.

Here is an example:
welds

I believe this wouldn’t work though.

1 Like

Yeah I did that, it doesn’t make a difference unfortunately.

How are you detecting where to place the item? If you are using a ray, or using the player mouse, my previous solution will work for you. Basically, just weld the item to the part it is placed on. This works perfectly in my DEMO, and still has the behavior you want.

If you wanted parts to be welded to every part that the part is placed by, @SSSpencer413 has a great solution for that below.

Are you able to use GetTouchingParts() on the placed part, then weld all of the touching parts if they’ve been placed or whatever?

Depending on your placement system, you might be able to do it with a much simpler solution.

Sorry, I didn’t see your previous reply and yeah that works thank you, however should I add server checks with Region3?

Well, you should always add server-side checks. You can do this by checking the magnitude of the 2 parts, and if they are close enough, you are good. Generally, make sure the client side checks are also done on the server. For example, make sure the position is on the grid.

coudnt u add constraints to the surfaces of the blocks and make them together?

What constraints do I need to add?

1 Like

make an instance for that,constraints are mostly used for cars…etc

This could work, however it could be more complicated to figure out the surfaces you want to constrain together.

1 Like

I thought that might be the case too