I want the Mouse.Target to ignore the identifyer block

this is in a local script

inputservice = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local Block = Instance.new("Part")
Block.Material = "Brick"
Block.Color = Color3.new(0.666667, 0.333333, 0)
Block.Parent = workspace
Block.Size = Vector3.new(3,3,3)
Block.Name = "Pending"
Block.Transparency = .5
Block.CanCollide = false
Block.Anchored = true
Block.CanTouch = false

while wait() do
	if mouse.Target == nil then
	else
		if mouse.Target.Name == "Pending" then
		else
			print(mouse.TargetSurface.Name)
			if mouse.TargetSurface.Name == "Top" then
				Block.Position = mouse.Target.Position +Vector3.new(0,3,0)	
			end
			if mouse.TargetSurface.Name == "Right" then
				Block.Position = mouse.Target.Position +Vector3.new(3,0,0)
			end
			if mouse.TargetSurface.Name == "Front" then
				Block.Position = mouse.Target.Position +Vector3.new(0,0,-3)
			end
			if mouse.TargetSurface.Name == "Back" then
				Block.Position = mouse.Target.Position +Vector3.new(0,0,3)
			end
			if mouse.TargetSurface.Name == "Left" then
				Block.Position = mouse.Target.Position +Vector3.new(-3,0,0)
			end
			if mouse.TargetSurface.Name == "Bottom" then
				Block.Position = mouse.Target.Position +Vector3.new(0,-3,0)	
			end
		end
	end
end

inputservice.InputBegan:Connect(function(input, gameprossessd)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		local newBlock = Instance.new("Part")
		newBlock.Material = "Brick"
		newBlock.Color = Color3.new(0.666667, 0.333333, 0)
		newBlock.Parent = workspace
		newBlock.Size = Vector3.new(3,3,3)
		newBlock.Name = (player.Name.."'s Block")
		newBlock.Transparency = 0
		newBlock.CanCollide = true
		newBlock.Anchored = true
		newBlock.CanTouch = false
		newBlock.Position = Block.Position
		
		local ID = Instance.new("IntValue", newBlock)
		ID.Name = "CanbePlaced"
		
	end
end)

as in the video I just want the mouse.Target to ignore the identifer block

mouse.TargetFilter

Edit: Mouse.TargetFilter allows you to set objects to be ignored by mouse.Target

1 Like

uh, how would I do that in this case? It’s pretty confusing

You’d set TargetFilter to a object that you want to be ignored.

1 Like

Your variable is mouse. So we can use this:
mouse.TargetFilter = game.Workspace.Baseplate

Instead of game.Workspace.Baseplate you would put the block. In your example:

mouse.TargetFilter = Block

1 Like

:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

1 Like

Awesome! Great to see it working. Good luck on development!

1 Like