Skip to content


A caster is an object that represents a type of ranged weapon (or whatever the module is representing). It provides a means of firing projectiles as well as keeping track of these projectiles. It is analogous to a gun or other firing mechanism.


WorldRoot WorldRoot


Changing this value will not update any existing ActiveCasts during runtime. When an ActiveCast is instantiated by a Caster, it looks at this property to see what it should set its own WorldRoot property to (see CastRayInfo), and then from there onward, it uses its own property to determine where to simulate.

The target WorldRoot that this Caster runs in by default. Its default value is workspace.

boolean SimulateBeforePhysics


The original behavior of FastCast effectively had this as true on the client and false on the server, however this setup may not be a good idea. The recommended value is false for both client and server.

If true, then raycast simulation will occur on PreSimulation, causing the cast to calculate before physics are updated. In contrast, a value of false means that raycast simulation will occur on PostSimulation, causing the cast to calculate after physics are updated. The default value is false.


ActiveCast (
    Vector3 ,
    Vector3 ,
    Variant<Vector3, number> ,


Fires a ray from this Caster. This actively simulated ray (or "bullet") is represented as an object referred to as an ActiveCast. The velocity parameter can either be a number or a Vector3. If it is a number, it will be in the same direction as direction and effectively represents a speed for your cast in studs/sec.

All properties that define how this ray will behave are in the dataPacket parameter. See FastCastBehavior for more information.



A common mistake people make is connecting to these events every time their weapon fires. These events only need to be connected to once.

RBXScriptSignal LengthChanged(ActiveCast , Vector3 , Vector3 , number , Vector3 , Instance )

This event fires every time any ray fired by this Caster updates and moves. The lastPoint parameter is point the ray was at before it was moved. rayDir represents the direction of movement, and displacement represents how far it moved in that direction. To calculate the current point, use lastPoint + (rayDir * displacement). segmentVelocity represents the velocity of the bullet at the time this event fired. cosmeticBulletObject is a reference to the cosmetic bullet passed into the Fire method (or nil if no such object was passed in)

RBXScriptSignal RayHit(ActiveCast , RaycastResult , Vector3 , Instance )

Only Handle Hitting!

Don't delete your cosmetic bullet here! Your cosmetic bullet should always be deleted in CastTerminating as this is not guaranteed to always fire. This event handler should exclusively determine what happens when the ray hits - nothing more.


The RaycastResult passed into this event will never be nil.

This event fires when any ray fired by this Caster runs into something and will be subsequently terminated. The first parameter references the ActiveCast that fired this event. The returned RaycastResult is the result of the ray that caused this hit to occur. segmentVelocity is the velocity of the bullet at the time of the hit, and cosmeticBulletObject is a reference to the passed in cosmetic bullet. This will not fire if the ray hits nothing and instead reaches its maximum distance.

RBXScriptSignal RayPierced(ActiveCast , RaycastResult , Vector3 , Instance )


The RaycastResult passed into this event will never be nil.

This functions absolutely identically to RayHit with the exception that it instead fires when the ray pierces something. This will never fire if canPierceFunction is nil.

RBXScriptSignal CastTerminating(ActiveCast )

This event fires while a ray is terminating (so after RayHit has fired, when applicable, but before all of the data in the ActiveCast is disposed of. It is still safe to access cast information in this event handler.)