# How do I make part stick to moving parts without welds

Hey guys, I’m having problems with my orbiting planets the player is able to spawn a spaceship but because of the orbit of the planet the spaceship gets flung is there any way to make a part stay to other moving parts (without using welds probably) I’m litterally scratching my head. Thanks

Could you put the planets and ships into different collision groups or do they need to collide?

they need to collide because the starship is supposed to be spawned steadily on the surface so the player can walk in

Can you weld it to “land” then unweld it for take offs?

i might beable to should i just use a ontouch event?

I would. Then w/e button they press to take-off would destroy the weld.

yes but there are more than 3000 places and planets you can land on so idk how to choose how to weld it on

on touch, get the touch part. Then you have both the ship and the planet/place.

So ok, let me elaborate some… You could put the touch event on either the ship or the planet/places… When one touches the other, the “otherPart” parameter of the event gives you the other part. You have to verify “otherpart” is the ship or the planet/place (whichever you chose) then set the weld. I would parent the weld to the ship. This way when the player goes to take off. You can easily find the weld in the ship and destroy it.

The closest you can get is AlignPosition which will attempt to, as the object’s name states, align an object to a position via physics. Welds rigidly stick and move parts to the part they’re attached to, however there’s really no other way to get that same behaviour. Physics and setting the CFrame are the closest you can get to that same behaviour.

1 Like

But im pretty sure that would just constantly drag the part towards the center

You can make a part proxy that movement with CFrame. Create an artificial orbit using CFramed parts and then use AlignPosition so that the planets use physics to try and reach the CFramed parts. Just takes a little thinking on these problems on how best you can solve them.

Reference:

so i can make a check for parts that have a example configuration and it sees that and drags that part towards slowly?