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

What advantage does FindPartOnRay have instead of Touched event?

Asked by 5 years ago

I am wondering why I should use the FindPartOnRay instead of Touched event when the Touched event also does the same thing

What should I use for a gun that shoots instantly and damages

Should I use a touched event for a slower gun? that does not go too fast and moves slowly? for this should I still use ray or use body velocity with mouse

0
I would use rays because they are more accurate. Definitely use them for fast projectiles. OBenjOne 190 — 5y

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
5 years ago

For a gun that shoots instantly and damages, use FindPartOnRay. It strikes out all wait because--well, finding a part on a raycast is near instant.

.Touched a part to touch another part in order for it to fire. FindPartOnRay does not. A ray is not a part.

A downside to touched is the fact that a part can and will go through a hitbox and not fire if you use CFrame:lerp / TweenService / etc--because touched sucks. I'd use BodyVelocity + Mouse.

Ad

Answer this question