Local part approaches to the camera when moving cursor on it

everytime i move my cursor on the part, it comes closer to the camera. how can i make it ignore without setting CanQuery property to false?

-- LocalScript in game.StarterPlayer.StarterPlayerScripts

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local Part = Instance.new("Part")
Part.Name = "Ball_Cursor"
Part.Shape = Enum.PartType.Ball
Part.Size = Vector3.new(1, 1, 1)
Part.Color = Color3.fromHex("#F33")
Part.Reflectance = 0.5
Part.Transparency = 0.5
Part.Anchored = true
Part.CanCollide = false
Part.Parent = workspace.Local_Workspace

Mouse.Move:Connect(function()
	Part.CFrame = CFrame.new(Mouse.Hit.Position)
end)

Mouse has a property called TargetFilter, Setting the Filter as the part will make the mouse ignore the part.

-- LocalScript in game.StarterPlayer.StarterPlayerScripts

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local Part = Instance.new("Part")
Part.Name = "Ball_Cursor"
Part.Shape = Enum.PartType.Ball
Part.Size = Vector3.new(1, 1, 1)
Part.Color = Color3.fromHex("#F33")
Part.Reflectance = 0.5
Part.Transparency = 0.5
Part.Anchored = true
Part.CanCollide = false
Part.Parent = workspace.Local_Workspace

Mouse.TargetFilter = Part

Mouse.Move:Connect(function()
	Part.CFrame = CFrame.new(Mouse.Hit.Position)
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.