Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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]]{})

1 comment

0

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.