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

What advantage does FindPartOnRay have instead of Touched event?

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

1 comment

0

I would use rays because they are more accurate. Definitely use them for fast projectiles.

1 answer

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.

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