So, I want to detect when someone clicks their character with their mouse. The trouble is, Mouse.Target apparently ignores your character, since when I click my character, Mouse.Target equals the thing behind me, like I’m clicking through myself.
I’ve tried using a click detector, but apparently that also doesn’t function if it’s in your character.
Your Character is ignored from the Mouse.Target and ClickDetectors, the only time you can click on your body I believe is when you are sitting in a VehicleSeat.
Does setting mouse.TargetFilter to nil help? If not, and even if it does, I personally just recommend using a custom solution. The mouse is legacy anyway.
local UserInputService = game:GetService("UserInputService")
local Workspace = game:GetService("Workspace")
local camera = Workspace.CurrentCamera
local function get_target(params: RaycastParams?): Instance?
local mouse_location = UserInputService:GetMouseLocation()
local ray = camera:ViewportPointToRay(mouse_location.X, mouse_location.Y)
local result = Workspace:Raycast(ray.Origin, ray.Direction*1000, params)
return result and result.Instance
end