My Part floats into the Camera for some reason

Hi, I wanna make a simple part placing system but I got a problem. I made a while loop that displays a fake part so people can see the position where the part would be placed. The problem is that it somehow always goes to the camera for some reason. (No clue to explain just view the Video). Is there a way so this doesnt float into my camera?

-- mouse.hit.p = "Position of Mouse"
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local equipped = false 

script.Parent.Equipped:Connect(function()
	equipped = true
end)

script.Parent.Unequipped:Connect(function()
	equipped = false
end)

while wait() do
	if equipped then
		if not game.Workspace:FindFirstChild("cursorpointer_"..player.UserId) then
			local Part = Instance.new("Part")
			Part.Name = "cursorpointer_"..player.UserId
			Part.Parent = game.Workspace
			Part.Transparency = 0.5
			Part.CanCollide = false
			Part.Anchored = true
		end
		local Part = game.Workspace:FindFirstChild("cursorpointer_"..player.UserId)
		Part.Position = mouse.hit.p
	else
		if game.Workspace:FindFirstChild("cursorpointer_"..player.UserId) then
			local Part = game.Workspace:FindFirstChild("cursorpointer_"..player.UserId)
			Part:Destroy()
		end
	end
end
1 Like

Properties (gyazo.com)

mouse.TargetFilter = part

Ray hits part on surface, part goes to that point on surface --repeat until part floats to camera.

Make it so that the mouse ray doesn’t hit the part at all

Ah, thanks, it actually works!