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 make Raycasting "Wider"?

I have this script that fires a ray that hits anything within 5 studs of the Player's torso but it seems to only fire in a small straight line making it hard for the ray to hit moving targets. Is there a way to make rays "wider"?

local PUNCH_RANGE = 5
local torso = Player.Character.Torso
local ray = Ray.new(torso.Position, torso.CFrame.lookVector * PUNCH_RANGE)
local part, endPoint = workspace:FindPartOnRay(ray, Player.Character)

1 answer

✓ Accepted answer

The short answer: You can't.

The long answer: Rays are simply lines. That's it. They don't have a width, they only can detect things along its path. Maybe you can make multiple rays in a circle if you need to.

2 comments

0

wow.

1

Not sure if this would work, but try adding an animation function to the part that increases the size. I just barely learned how to create Rays myself a few hours ago, and I found some cools tricks that helped.

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