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

Adding multiple things to the "ignore" parameter in raycasting?

Asked by 10 years ago

Hey guys.

I would like to know how to add multiple things to the ignore parameter in raycasting, usually people just use player.Character but I have an issue where the bullets get stopped by other bullets, is there any way I can add both things to the "ignore" parameter or a possible workaround? (such as placing the raycasted bullets into the character?)

And for reference, this is what I'm talking about: local part, pos = game.Workspace:FindPartOnRay(Ray.new(tool.Handle.CFrame.p,(mouse.Hit.p - tool.Handle.CFrame.p).unit*999),player.Character)

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

What you're looking for is the FindPartOnRayWithIgnoreList method. It's identical to FindPartOnRay except that the 'Ignore' parameter is now a Table of Instances, rather than a single Instance. It will ignore any instances in the given table, and any of their descendants.

Ad

Answer this question