How can I prevent my part from placing in the ground?

I’m working on a placement system for a game I am making and I’m having problems with my visualizer.

Right now the visualizer appears in the floor, when I need it to appear on top of the floor.

The code I use to determine the position it displays at is here:
local visualizerPosition = Vector3.new(playerMouse.Hit.Position.X, playerMouse.Hit.Position.Y, playerMouse.Hit.Position.Z)

And before you say “Just add + visualizer.Size.Y to the Y coordinate” I want to make clear that I have tried it, and it has worked, but it has created a problem where if the mouse is in a certain spot, the visualizer will fly to your camera constantly.

Could someone give me ideas on how I could fix this instead?

1 Like

You can prevent that by ignoring the visualizer part in the raycast.

1 Like

I might try switching to RayCasting, but I don’t know how well that will work because in my current script, the visualizer is ignored:

	while playerMouse ~= nil do
		local visualizerPosition = Vector3.new(playerMouse.Hit.Position.X, playerMouse.Hit.Position.Y, playerMouse.Hit.Position.Z)

		playerMouse.TargetFilter = visualizer or character
		visualizer.Position = visualizerPosition
1 Like

Could you set the visualizer part’s CanQuery option to false?
Should make it be ignored by the mouse.