I know there's mouse.TargetFilter
, but is there a way I can invert this to a whitelist instead of a blacklist?
So far I could maybe loop through all descendants of workspace, and if it's NOT on a certain list, exclude it from the mouse, but that seems like a LOT of parts and it would probably
You could use workspace:FindPartOnRayWithWhitelist() instead.
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() local ray = Ray.new(mouse.UnitRay.Origin, (mouse.Hit.p - mouse.UnitRay.Origin).unit * 5000) local Part, Hit = workspace:FindPartOnRayWithWhitelist(ray, --[[whitelist here]]{})