Placing a Model using Mouse

Hello, i need help. I’m trying to make a move tool to move the model i want the mouse to ignore the model, and the primary part is going to follow to the mouse position.

local bp = workspace.Part.BodyPosition
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()

if Player then
	spawn(function()
		while wait() do
			bp.Position = Vector3.new(mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z)
		end
	end)
end

Hi,
you’re doing it wrong I guess, mouse has lots of useful functions:
I don’t know if it’s workspace.Part that you want to move, but if it’s the case just do:

local p = workspace.Part;
local m = game.Players.LocalPlayer:GetMouse();
local rotation = 0; --you can make it change for example if the user presses R

m.TargetFilter = p; --ignores the part you're moving (so it doesn't make a weird thing

m.Move:Connect(function()
   p.CFrame = CFrame.new(m.Hit.X/2,m.Hit.Y+p.Size.Y/2,m.Hit.Z)
end)
8 Likes

No, i’m using the BodyPosition to be smooth.

Smooth, do you mean without lag or that it does like a tweening?

1 Like

Tweening

I use lerp, check that on wiki it works finely

1 Like

Ok, i just typed a short script.

Thank you i only need to the mouse to ignore the model ty.

If you want to smoothly move a model, you should be using the TweenService or a CFrame method over a BodyPosition. BodyForce objects aren’t intended to be tween objects.

Yeah, i did.