Scripting Problems With BodyVelocity

I’m trying to script a Laser Gun, but I don’t know how to make the laser move in the direction of the ray using a bodyvelocity.

Does anyone know how I can go about doing this? I’m just confused on how to implement a to “BodyVelocity.Velocity”. I tried “BodyVelocity.Velocity =” but that seems to give me errors.

A BodyVelocity needs a Vector3. A ray’s Vector3 can be gotten from Ray.Unit.Direction.

Velocity needs a Vector3, not a ray.

If your ray already exists then do Ray.Direction to get it’s direction and set that as the velocity.

Read the docs of the Ray class here to understand the Direction property: Ray | Documentation - Roblox Creator Hub

Edit: the answer from @posatta made me think about magnitude. Set the velocity to Ray.Unit.Direction * Speed where speed is the speed you want it to move in that direction in studs per second.