Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I set a mouse whitelist? (Opposite of mouse.TargetFilter)

Asked by 6 years ago

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

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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]]{})
0
Thanks Professor_Boxtrot 136 — 6y
Ad

Answer this question