Hello! Recently I've taken on the challenge of making my own generic building tools. I've made a copy and a delete tool, but the move tool is harder. I've been trying to make it so that the part (target in my script) moves to the mouse's position, but obviously after that is done, I had to make adjustments. For example, I had to raise it so it wasn't stuck in the floor and make sure all welds were broken on the part. Anyway, with all that done, it looks like this. I know that this happens because I made the part move up until it's no longer colliding at whatever position it should be in. However, for it to work the way I want, I need to move it toward the camera until it isn't colliding with anything. That way, I would be able to attach parts to walls.
Here is the relevant part of my code, on a server script:
target.Position = mouseHit.Position
local touchingParts = target:GetTouchingParts()
if #touchingParts > 0 then
repeat
target.CFrame = target.CFrame + Vector3.new(0, 0.01, 0)
touchingParts = target:GetTouchingParts()
until #touchingParts == 0
end
Line 8 in particular is the line where I raise the part. Instead of raising it, I need to move it toward the camera, but I'm not quite sure how to accomplish that. Could you guys maybe point me in the right direction? Any help is appreciated!
