How would I code moving a part around in-game?

Depends how he does it.
If you set the part/model’s CFrame to the CFrame of mouse.Hit/camera.CFrame it will change it’s orientation.

You will have to just change the position aspect of the CFrame and leave the rotation matrix alone.

If he is using Mouse.Hit it returns with no rotation matrix, which means the rotation wouldn’t change; of course if he does use a camera route, he would have to constantly set the rotation matrix to a constant rotation.

Right, but mouse.Hit would result in the part going to where the mouse hit obviously. But as I said i want the part to stop 10 studs from the character. I do not want it to go further than 10 studs.

This is the post where-as I explain how to stop the part from going more than 10 studs from the character.

That’s why you do a magnitude check, if it exceeds 10 studs, you make it only go 10 studs by having an else statement manually set it to 10.

Yes, I completely understand. Thank you, but another question. I promise the last one. How would I place the part 10 studs away from the character?

I assume you mean 10 studs in the direction they are looking.

local camera = workspace.CurrentCamera
part.CFrame = camera.CFrame * CFrame.new(0, 0, 10) – do -10 failing that.

Once the player selects the brick you could immediately set the parts position to the players position + 10 studs in a certain direction, or you could use their lookVector as oppose to their position.

Both of you are correct. So what I ended up doing and it works is;

PART.CFrame = camera.CFrame + (camera.CFrame.lookVector*25)
PART.Orientation = Vector3.new(0,0,0)

Thank you so much. Both of you, I really really appreciate it. :slight_smile:

1 Like

Make this the solution to the post so that forum members don’t continue to reply to this post thinking it is unsolved.

Did it, yet again thank you so much.

1 Like

Please clarify the details of your post in your initial topic next time :slight_smile: