How could i get this to stop happening

Basically im trying to make a part go where the mouse is but then the mouse goes on top of the part and the part keeps going upwards trying to catch up with the mouse and etc, how do i stop that:

local rs = game:GetService("RunService")

rs.Stepped:Connect(function()
	if game:GetService("UserInputService"):IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then
		
		local filtered = {game.Players.LocalPlayer.Character}
		local params = RaycastParams.new()
		params.FilterType = Enum.RaycastFilterType.Exclude
		params.FilterDescendantsInstances = filtered
		
		local pos = game:GetService("UserInputService"):GetMouseLocation()
		local WorldToScreenPoint = workspace.CurrentCamera:ViewportPointToRay(pos.X, pos.Y)
		local ray = workspace:Raycast(WorldToScreenPoint.Origin, WorldToScreenPoint.Direction*100, params)
		if ray and ray.Instance then
			if ray.Instance:IsA("Part") and ray.Instance.Name ~= "Baseplate" then
				ray.Instance.Position = ray.Position
			end
		end
	end
end)

make sure the part is ignored by the mouse

how would i do that? {char minimum]

local filtered = {game.Players.LocalPlayer.Character, (game.workspace.whatever)}

If you have to be pointing at the part and MouseButton1 where else is the part going to go …
You’re telling it to go where the mouse is pointing.

Maybe:
1st step click to activate the part (maybe outline),
2nd step move the part to where the next click is.

1 Like

Are you making a grid type building system for placing Parts exactly on or beside other Parts?

Try searching the forums for Grid placement system. You’ll find a lot of helpful posts about exactly what you’re trying to do.

1 Like