Skip to content

Definitions

This page contains all types defined and used by SecureCast.


type Modifier (
 number Loss,
 number Power,
 number Angle,
 number Gravity,
 number Velocity,
 number Lifetime,
 BindableEvent? OnImpact,
 BindableEvent? OnDestroyed,
 BindableEvent? OnIntersection,
 RaycastParams? RaycastFilter,
 {[string]: any}? Extra,
)

Modifiers are a powerful tool that allows you to define per cast functionality seperate from the base projectile definition.

Custom event handling
local Bindable = Instance.new("BindableEvent")
Bindable.Event:Connect(function(Type: string, Event: string, ...)
    if Event == "OnDestroyed" then
        --> No need to keep a reference to the connection 
        --> since destroy will take care of it for us
        Bindable:Destroy()
    elseif Event == "OnImpact" then

    elseif Event == "OnIntersection" then

    end
end)

local Modifier = {
    OnImpact = Bindable,
    OnDestroyed = Bindable,
    OnIntersection = Bindable,
}

SecureCast.Cast(Player, "Bullet", Origin, Direction, Time, nil, Modifier)

Danger

When using Modifiers make sure that all clients and the server use the same modifier, improper modifier usage can result in simulation desync.


type Definition (
 number Loss,
 number Power,
 number Angle,
 number Gravity,
 number Velocity,
 number Lifetime,
 BindableEvent? Output,
 RaycastParams? RaycastFilter,
 void OnImpact (
  Player Caster,
  Vector3 Direction,
  Instance Instance,
  Vector3 Normal,
  Vector3 Position,
  Enum.Material Material
  {[string]: any}? Extra,
 ),
 void OnDestroyed (
  Player Caster,
  Vector3 Position
  {[string]: any}? Extra,
 ),
 void OnIntersection (
  Player Caster,
  Vector3 Direction,
  string Part,
  Player? Victim,
  Vector3 Position
  Model? VictimCharacter,
  {[string]: any}? Extra,
 ),
)

This type represents the way that projectiles should be defined within the system.
Refer to the template bullet included within the GitHub repository for an example.


type Record (
 {CFrame} Parts,
 Vector3 Position,
)


type Snapshot (
 number Time,
 Voxels.Grid Grid,
 {[Player]: Record} Records,
)