Modding API Functions

A searchable list of functions available in the TrailKit library.

Anim

15 functions

TrailKit.Anim.tween

function TrailKit.Anim.tween( options )
Tweens an object's position, rotation, or scale.
Parameter Type Description
options TweenOptions The tween options

TrailKit.Anim.path

function TrailKit.Anim.path( options )
Moves an object along a defined path of frames.
Parameter Type Description
options PathOptions The path options

TrailKit.Anim.pulse

function TrailKit.Anim.pulse( options )
Pulses an object's scale.
Parameter Type Description
options PulseOptions The pulse options

TrailKit.Anim.bob

function TrailKit.Anim.bob( options )
Bobs an object up and down.
Parameter Type Description
options BobOptions The bob options

TrailKit.Anim.spin

function TrailKit.Anim.spin( options )
Spins an object around an axis.
Parameter Type Description
options SpinOptions The spin options

TrailKit.Anim.shake

function TrailKit.Anim.shake( options )
Shakes an object.
Parameter Type Description
options ShakeOptions The shake options

TrailKit.Anim.orbit

function TrailKit.Anim.orbit( options )
Makes an object orbit around a center point.
Parameter Type Description
options OrbitOptions The orbit options

TrailKit.Anim.lookAt

function TrailKit.Anim.lookAt( options )
Makes an object look at a target.
Parameter Type Description
options LookAtOptions The look at options

TrailKit.Anim.follow

function TrailKit.Anim.follow( options )
Makes an object follow a target.
Parameter Type Description
options FollowOptions The follow options

TrailKit.Anim.stop

function TrailKit.Anim.stop( options )
Stops all animations on a handle.
Parameter Type Description
options { handle: ObjectHandle }

TrailKit.Anim.pause

function TrailKit.Anim.pause( options )
Pauses animations on a handle.
Parameter Type Description
options { handle: ObjectHandle }

TrailKit.Anim.resume

function TrailKit.Anim.resume( options )
Resumes animations on a handle.
Parameter Type Description
options { handle: ObjectHandle }

TrailKit.Anim.sequence

function TrailKit.Anim.sequence( options )
Runs a sequence of animations.
Parameter Type Description
options SequenceOptions configuration

TrailKit.Anim.sequenceGroup

function TrailKit.Anim.sequenceGroup( options )
Runs a sequence on a group of objects.
Parameter Type Description
options { groupHandle: GroupHandle, animations: table[], delay?: number }

TrailKit.Anim.crossfade

function TrailKit.Anim.crossfade( options )
Fades from current state to another animation.
Parameter Type Description
options { handle: ObjectHandle, to: string, toOptions: table, duration?: number }

Bridge

8 functions

TrailKit.Bridge.init

function TrailKit.Bridge.init()
Initializes the bridge (internal).

TrailKit.Bridge.update

function TrailKit.Bridge.update()
Updates the bridge (internal).

TrailKit.Bridge.send

function TrailKit.Bridge.send( channel , data )
Sends a message on a specific channel used for other mods to listen to.
Parameter Type Description
channel string
data any

TrailKit.Bridge.on

function TrailKit.Bridge.on( channel , callback )
Registers a callback for a specific channel.
Parameter Type Description
channel string
callback function

TrailKit.Bridge.setData

function TrailKit.Bridge.setData( apiKey , key , value , callback )
Sets data in the shared database/bridge.
Parameter Type Description
apiKey string
key string
value any
callback function

TrailKit.Bridge.getData

function TrailKit.Bridge.getData( apiKey , key , callback )
Gets data from the shared database/bridge.
Parameter Type Description
apiKey string
key string
callback function

TrailKit.Bridge.handleChatMessage

function TrailKit.Bridge.handleChatMessage( senderName , message ) → boolean
Handles incoming chat messages to check for bridge commands.
Parameter Type Description
senderName string
message string

TrailKit.Bridge.getTaggedSender

function TrailKit.Bridge.getTaggedSender( name ) → string
Gets the sender name with the mod tag appended.
Parameter Type Description
name string

Camera

9 functions

TrailKit.Camera.playCinematic

function TrailKit.Camera.playCinematic( options )
Plays a cinematic path from a file.
Parameter Type Description
options CinematicOptions Config

TrailKit.Camera.tweenTo

function TrailKit.Camera.tweenTo( options )
Tweens the camera to a specific destination.
Parameter Type Description
options CamTweenOptions Config

TrailKit.Camera.follow

function TrailKit.Camera.follow( options )
Makes the camera follow a target.
Parameter Type Description
options CamFollowOptions Config

TrailKit.Camera.lookAt

function TrailKit.Camera.lookAt( options )
Makes the camera look at a target.
Parameter Type Description
options CamLookAtOptions Config

TrailKit.Camera.orbit

function TrailKit.Camera.orbit( options )
Makes the camera orbit a target.
Parameter Type Description
options CamOrbitOptions Config

TrailKit.Camera.release

function TrailKit.Camera.release( options )
Stops any camera manipulation and returns control to player.
Parameter Type Description
options CamReleaseOptions Config

TrailKit.Camera.pause

function TrailKit.Camera.pause( options )
Pauses the current camera sequence.
Parameter Type Description
options CamPauseOptions Config

TrailKit.Camera.resume

function TrailKit.Camera.resume( options )
Resumes the current camera sequence.
Parameter Type Description
options CamResumeOptions Config

TrailKit.Camera.isPlaying

function TrailKit.Camera.isPlaying( playerId ) → boolean
Checks if a player is currently in a cinematic mode.
Parameter Type Description
playerId number Player ID

Dialogue

5 functions

TrailKit.Dialogue.create

function TrailKit.Dialogue.create( options )
Creates a new dialogue definition.
Parameter Type Description
options DialogueDefOptions Config

TrailKit.Dialogue.initialize

function TrailKit.Dialogue.initialize()
Initialize triggers.

TrailKit.Dialogue.start

function TrailKit.Dialogue.start( options )
Starts a dialogue for a player.
Parameter Type Description
options DialogueStartOptions Config

TrailKit.Dialogue.endDialogue

function TrailKit.Dialogue.endDialogue( options )
Ends the current dialogue for a player.
Parameter Type Description
options DialogueEndOptions Config

TrailKit.Dialogue.getActiveDialogue

function TrailKit.Dialogue.getActiveDialogue( playerId ) → {
Gets the active dialogue state for a player.
Parameter Type Description
playerId number Player ID

Event

5 functions

TrailKit.Event.emit

function TrailKit.Event.emit( eventName )
Emits an event with the given name and arguments.
Parameter Type Description
eventName string The name of the event

TrailKit.Event.on

function TrailKit.Event.on( eventName , callback )
Registers a callback for an event.
Parameter Type Description
eventName string The name of the event to listen for
callback function The function to call when the event is emitted

TrailKit.Event.once

function TrailKit.Event.once( eventName , callback )
Registers a callback that runs only once for an event.
Parameter Type Description
eventName string The name of the event
callback function The function to call

TrailKit.Event.off

function TrailKit.Event.off( eventName , handler )
Removes a specific listener.
Parameter Type Description
eventName string The event name
handler function The specific function to remove

TrailKit.Event.clear

function TrailKit.Event.clear( eventName )
Removes all listeners for a specific event (or all events if name is nil).
Parameter Type Description
eventName string (Optional) The name of the event

Game

4 functions

TrailKit.Game.setTimeScale

function TrailKit.Game.setTimeScale( scale )
Sets the global time scale of the game.
Parameter Type Description
scale number (e.g. 1.0 for normal speed, 0.5 for half speed)

TrailKit.Game.getTimeScale

function TrailKit.Game.getTimeScale() → number
Gets the current time scale.

TrailKit.Game.setGravity

function TrailKit.Game.setGravity( gravity )
Sets global gravity multiplier or vector.
Parameter Type Description
gravity number|vector3

TrailKit.Game.setComplexity

function TrailKit.Game.setComplexity( value )
Sets the build complexity limit.
Parameter Type Description
value number

Input

14 functions

TrailKit.Input.onKeyDown

function TrailKit.Input.onKeyDown( keyName , callback , options )
Registers a callback for a key down event.
Parameter Type Description
keyName string Key name
callback function Callback function
options KBOptions (Optional) Optional config

TrailKit.Input.onKeyUp

function TrailKit.Input.onKeyUp( keyName , callback , options )
Registers a callback for a key up event.
Parameter Type Description
keyName string Key name
callback function Callback function
options KBOptions (Optional) Optional config

TrailKit.Input.whileKeyHeld

function TrailKit.Input.whileKeyHeld( keyName , callback , options )
Registers a callback loop while a key is held.
Parameter Type Description
keyName string Key name
callback function Callback function
options KBOptions (Optional) Optional config

TrailKit.Input.onMouseDown

function TrailKit.Input.onMouseDown( callback , options )
Registers a callback for mouse down events (anywhere).
Parameter Type Description
callback function Callback function
options KBOptions (Optional) Optional config

TrailKit.Input.onObjectClicked

function TrailKit.Input.onObjectClicked( callback , options )
Registers a callback for when a specific object type is clicked.
Parameter Type Description
callback function Callback function
options KBOptions (Optional) Optional config

TrailKit.Input.onChat

function TrailKit.Input.onChat( callback )
Registers a callback for chat messages.
Parameter Type Description
callback function Callback function

TrailKit.Input.registerCommand

function TrailKit.Input.registerCommand( options )
Registers a chat command (e.g., /tp).
Parameter Type Description
options CommandOptions The command config

TrailKit.Input.getAvailableCommands

function TrailKit.Input.getAvailableCommands( playerObject ) → table[]
Gets available commands for a player.
Parameter Type Description
playerObject PlayerObject

TrailKit.Input.setContext

function TrailKit.Input.setContext( options )
Sets the input context for a player (filters callbacks).
Parameter Type Description
options ContextOptions configuration

TrailKit.Input.getContext

function TrailKit.Input.getContext( playerId ) → string
Gets the current context of a player.
Parameter Type Description
playerId number

TrailKit.Input.clearContext

function TrailKit.Input.clearContext( contextName )
Clears all callbacks for a context.
Parameter Type Description
contextName string

TrailKit.Input.messagePlayer

function TrailKit.Input.messagePlayer( options )
Sends a private chat message to a player.
Parameter Type Description
options MessageOptions configuration

TrailKit.Input.broadcast

function TrailKit.Input.broadcast( message , color )
Broadcasts a chat message to all players.
Parameter Type Description
message string Content
color color (Optional) Color

TrailKit.Input.serverMessage

function TrailKit.Input.serverMessage( message )
Logs and broadcasts a server message.
Parameter Type Description
message string

Log

5 functions

TrailKit.Log.info

function TrailKit.Log.info( message )
Parameter Type Description
message string The message to log

TrailKit.Log.warn

function TrailKit.Log.warn( message )
Parameter Type Description
message string The warning message

TrailKit.Log.error

function TrailKit.Log.error( message )
Parameter Type Description
message string The error message

TrailKit.Log.debug

function TrailKit.Log.debug( message )
Parameter Type Description
message string The debug message (only logged if UnifiedLogConfig.Debug is true)

TrailKit.Log.log

function TrailKit.Log.log( level , message )
Parameter Type Description
level string "INFO", "WARN", "ERROR", or "DEBUG"
message string

Math

8 functions

TrailKit.Math.clamp

function TrailKit.Math.clamp( val , min , max ) → number
Clamps a value between min and max.
Parameter Type Description
val number The value to clamp
min number The minimum value
max number The maximum value

TrailKit.Math.lerp

function TrailKit.Math.lerp( a , b , t ) → number
Linearly interpolates between a and b by t (clamped 0-1).
Parameter Type Description
a number Start value
b number End value
t number Interpolation factor (0-1)

TrailKit.Math.lerpUnclamped

function TrailKit.Math.lerpUnclamped( a , b , t ) → number
Linearly interpolates between a and b by t (unclamped).
Parameter Type Description
a number Start value
b number End value
t number Interpolation factor

TrailKit.Math.round

function TrailKit.Math.round( num , numDecimalPlaces ) → number
Rounds a number to the nearest integer or specified number of decimals.
Parameter Type Description
num number The number to round
numDecimalPlaces number (Optional) Optional number of decimal places

TrailKit.Math.map

function TrailKit.Math.map( value , from1 , to1 , from2 , to2 ) → number
Maps a value from one range to another.
Parameter Type Description
value number The value to map
from1 number Source range start
to1 number Source range end
from2 number Target range start
to2 number Target range end

TrailKit.Math.randomRange

function TrailKit.Math.randomRange( min , max ) → number
Returns a random number between min and max (inclusive of floats).
Parameter Type Description
min number Minimum value
max number Maximum value

TrailKit.Math.distance

function TrailKit.Math.distance( x1 , y1 , x2 , y2 ) → number
Calculates distance between two vectors or positions (2D).
Parameter Type Description
x1 number
y1 number
x2 number
y2 number

TrailKit.Math.sign

function TrailKit.Math.sign( num ) → number
Returns the sign of the number (1, -1, or 0).
Parameter Type Description
num number

Other

34 functions

PlayerObject:kill

function PlayerObject:kill()
Kills the player.

PlayerObject:teleport

function PlayerObject:teleport( position , rotation )
Teleports the player to a position and optionally rotation.
Parameter Type Description
position vector3
rotation quaternion (Optional)

PlayerObject:setInvincible

function PlayerObject:setInvincible( enabled )
Sets the player's invincibility state.
Parameter Type Description
enabled boolean

PlayerObject:setJetpack

function PlayerObject:setJetpack( enabled )
Sets jetpack enabled state.
Parameter Type Description
enabled boolean

PlayerObject:setBuilderEnabled

function PlayerObject:setBuilderEnabled( enabled )
Sets builder mode enabled.
Parameter Type Description
enabled boolean

PlayerObject:setRepairEnabled

function PlayerObject:setRepairEnabled( enabled )
Sets repair tool enabled.
Parameter Type Description
enabled boolean

PlayerObject:hasPermission

function PlayerObject:hasPermission( level ) → boolean
Checks if the player has a specific permission level/role.
Parameter Type Description
level string

PlayerObject:grantPermission

function PlayerObject:grantPermission( level )
Grants a permission level to the player.
Parameter Type Description
level string

PlayerObject:makePersistent

function PlayerObject:makePersistent()
Enables persistence for this player's data.

PlayerObject:save

function PlayerObject:save()
Saves the player's persistent data immediately.

PlayerObject:setData

function PlayerObject:setData( key , value )
Sets a value in the player's data table.
Parameter Type Description
key string
value any

PlayerObject:getData

function PlayerObject:getData( key ) → any
Gets a value from the player's data table.
Parameter Type Description
key string

PlayerObject:setState

function PlayerObject:setState( stateName , duration )
Sets the player's current interaction state context.
Parameter Type Description
stateName string
duration number (Optional) Optional auto-revert duration

PlayerObject:getState

function PlayerObject:getState() → string
Gets the current state name.

PlayerObject:isInState

function PlayerObject:isInState( stateName ) → boolean
Checks if the player is in a specific state.
Parameter Type Description
stateName string

PlayerObject:toast

function PlayerObject:toast( message , duration )
Displays a subtle toast message.
Parameter Type Description
message string
duration number (Optional)

PlayerObject:message

function PlayerObject:message( text , color )
Sends a chat message to the player.
Parameter Type Description
text string
color color (Optional)

PlayerObject:alert

function PlayerObject:alert( header , message , duration )
Shows an intrusive alert message.
Parameter Type Description
header string
message string
duration number (Optional)

ObjectHandle:setPosition

function ObjectHandle:setPosition( position )
Sets the world position of the object.
Parameter Type Description
position vector3

ObjectHandle:setRotation

function ObjectHandle:setRotation( rotation )
Sets the world rotation of the object.
Parameter Type Description
rotation quaternion

ObjectHandle:setScale

function ObjectHandle:setScale( scale )
Sets the scale of the object.
Parameter Type Description
scale number|vector3

ObjectHandle:setIsVisible

function ObjectHandle:setIsVisible( isVisible )
Sets visibility.
Parameter Type Description
isVisible boolean

ObjectHandle:setIsStatic

function ObjectHandle:setIsStatic( isStatic )
Sets static nature (physics).
Parameter Type Description
isStatic boolean

ObjectHandle:despawn

function ObjectHandle:despawn()
Despawns this object.

ObjectHandle:Exists

function ObjectHandle:Exists() → boolean
Checks if the object still exists in the game world.

ObjectHandle:move

function ObjectHandle:move( position , duration , options )
Animates the object (tween).
Parameter Type Description
position vector3
duration number
options ObjectMoveOptions (Optional) Config

ObjectHandle:rotate

function ObjectHandle:rotate()
Animates rotation.

ObjectHandle:scale

function ObjectHandle:scale()
Animates scale.

ObjectHandle:spin

function ObjectHandle:spin()
Starts a continuous spin.

ObjectHandle:pulse

function ObjectHandle:pulse()
Starts a pulse animation.

ObjectHandle:bob

function ObjectHandle:bob()
Starts a bobbing animation.

ObjectHandle:playSound

function ObjectHandle:playSound( soundName )
Plays a sound at this object's position.
Parameter Type Description
soundName string

ObjectHandle:attachSound

function ObjectHandle:attachSound( soundName , id )
Attaches a sound to this object.
Parameter Type Description
soundName string
id string

ObjectHandle:stopSound

function ObjectHandle:stopSound( id )
Stops an attached sound.
Parameter Type Description
id string

Perms

8 functions

TrailKit.Perms.registerRole

function TrailKit.Perms.registerRole( options )
Registers a role in the hierarchy.
Parameter Type Description
options { name: string, level: number }

TrailKit.Perms.grantPermission

function TrailKit.Perms.grantPermission( player , level )
Grants a permission level to a player.
Parameter Type Description
player PlayerObject|number
level string

TrailKit.Perms.grantTemporaryPermission

function TrailKit.Perms.grantTemporaryPermission( player , level , duration )
Grants a temporary permission that expires.
Parameter Type Description
player PlayerObject|number
level string
duration number

TrailKit.Perms.getPlayerPermission

function TrailKit.Perms.getPlayerPermission( player ) → string
Gets a player's current permission level.
Parameter Type Description
player PlayerObject|number

TrailKit.Perms.hasPermission

function TrailKit.Perms.hasPermission( player , requiredLevel ) → boolean
Checks if a player has at least the required permission level.
Parameter Type Description
player PlayerObject|number
requiredLevel string

TrailKit.Perms.promote

function TrailKit.Perms.promote( player ) → string
Promotes a player to the next role.
Parameter Type Description
player PlayerObject

TrailKit.Perms.demote

function TrailKit.Perms.demote( player ) → string
Demotes a player to the previous role.
Parameter Type Description
player PlayerObject

TrailKit.Perms.getPlayersInRole

function TrailKit.Perms.getPlayersInRole( roleName ) → PlayerObject[]
Gets all players with a specific role.
Parameter Type Description
roleName string

Physics

7 functions

TrailKit.Physics.spawnStructureWithConstantForce

function TrailKit.Physics.spawnStructureWithConstantForce( options ) → string
Spawns a structure with a constant force applied.
Parameter Type Description
options ForceOptions Config

TrailKit.Physics.spawnStructureWithPath

function TrailKit.Physics.spawnStructureWithPath( options ) → string
Spawns a structure that follows a path.
Parameter Type Description
options PhysicsPathOptions Config

TrailKit.Physics.removeConstantForce

function TrailKit.Physics.removeConstantForce( id )
Removes constant force from a structure.
Parameter Type Description
id string Structure ID

TrailKit.Physics.removePathFollowing

function TrailKit.Physics.removePathFollowing( id )
Stops path following for a structure.
Parameter Type Description
id string Structure ID

TrailKit.Physics.cleanupAll

function TrailKit.Physics.cleanupAll()
Cleans up all PhysicsLib managed structures.

TrailKit.Physics.Block

function TrailKit.Physics.Block( nativeBlock ) → BlockWrapper
Wraps a native block object.
Parameter Type Description
nativeBlock any Native Object

TrailKit.Physics.Structure

function TrailKit.Physics.Structure( nativeStructure ) → StructureWrapper
Wraps a native structure object.
Parameter Type Description
nativeStructure any Native Object

Player

8 functions

TrailKit.Player.getPlayer

function TrailKit.Player.getPlayer( playerId ) → PlayerObject
Gets a player object by their player ID.
Parameter Type Description
playerId number

TrailKit.Player.getPlayerByName

function TrailKit.Player.getPlayerByName( name ) → PlayerObject|nil
Gets a player object by their name.
Parameter Type Description
name string

TrailKit.Player.getPlayerByProfileId

function TrailKit.Player.getPlayerByProfileId( profileId ) → PlayerObject|nil
Gets a player object by their profile ID.
Parameter Type Description
profileId string

TrailKit.Player.getAllPlayers

function TrailKit.Player.getAllPlayers() → table<number,
Returns a table of all active player objects, keyed by player ID.

TrailKit.Player.getPlayersInTeam

function TrailKit.Player.getPlayersInTeam( teamId ) → PlayerObject[]
Returns a list of players in a specific team.
Parameter Type Description
teamId number

TrailKit.Player.getTargetPlayers

function TrailKit.Player.getTargetPlayers( target ) → number[]
Resolves a target (ID, name, PlayerObject, table of IDs, or 'all') into a list of player IDs.
Parameter Type Description
target any

TrailKit.Player.createSpawnLocation

function TrailKit.Player.createSpawnLocation( locationName , spawnPoints )
Creates a spawn location set.
Parameter Type Description
locationName string
spawnPoints table

TrailKit.Player.teleportToLocation

function TrailKit.Player.teleportToLocation( locationName , targetPlayers , keepStructures )
Teleports players to a named location.
Parameter Type Description
locationName string
targetPlayers any
keepStructures boolean (Optional)

Save

10 functions

TrailKit.Save.save

function TrailKit.Save.save( options ) → boolean
Saves data to a persistent JSON file.
Parameter Type Description
options SaveOptions The save options

TrailKit.Save.queueSave

function TrailKit.Save.queueSave( options ) → boolean
Queues a save operation to prevent spamming disk writes.
Parameter Type Description
options { id: string, data: table, delay?: number }

TrailKit.Save.load

function TrailKit.Save.load( options ) → table
Loads data from a persistent JSON file.
Parameter Type Description
options LoadOptions The load options

TrailKit.Save.updateValue

function TrailKit.Save.updateValue( options ) → boolean
Sets a specific value in a saved file (reads, updates, saves).
Parameter Type Description
options UpdateValueOptions The options

TrailKit.Save.getValue

function TrailKit.Save.getValue( options ) → any
Gets a specific value from a saved file.
Parameter Type Description
options GetValueOptions The options

TrailKit.Save.createAutosave

function TrailKit.Save.createAutosave( options )
Creates an autosave loop.
Parameter Type Description
options AutosaveOptions

TrailKit.Save.removeAutosave

function TrailKit.Save.removeAutosave( id )
Stops an autosave loop.
Parameter Type Description
id string

TrailKit.Save.delete

function TrailKit.Save.delete( options ) → boolean
Deletes a save file.
Parameter Type Description
options { id: string }

TrailKit.Save.exists

function TrailKit.Save.exists( options ) → boolean
Checks if a save file exists.
Parameter Type Description
options { id: string }

TrailKit.Save.clearCache

function TrailKit.Save.clearCache( options )
Clears the internal cache.
Parameter Type Description
options { (Optional) id?: string }

Scene

20 functions

TrailKit.Scene.spawnObject

function TrailKit.Scene.spawnObject( options ) → ObjectHandle
Spawns a standard game object.
Parameter Type Description
options SpawnOptions Config

TrailKit.Scene.spawnCustomObject

function TrailKit.Scene.spawnCustomObject( options ) → ObjectHandle
Spawns a custom object (OBJ/PNG).
Parameter Type Description
options CustomSpawnOptions Config

TrailKit.Scene.createGroup

function TrailKit.Scene.createGroup( options ) → GroupHandle
Creates a group to hold multiple objects.
Parameter Type Description
options GroupOptions Config

TrailKit.Scene.despawnNode

function TrailKit.Scene.despawnNode( node )
Despawns a node (Object or Group) and its children.
Parameter Type Description
node ObjectHandle|GroupHandle The node

TrailKit.Scene.getObject

function TrailKit.Scene.getObject( id ) → ObjectHandle|GroupHandle|PlayerObject
Gets a tracked object or group by ID.
Parameter Type Description
id string The ID

TrailKit.Scene.findEntitiesByTag

function TrailKit.Scene.findEntitiesByTag( tag , options ) → table[]
Finds entities by tag.
Parameter Type Description
tag string The tag
options FindOptions (Optional) Config

TrailKit.Scene.findEntitiesByName

function TrailKit.Scene.findEntitiesByName( name , options ) → table[]
Finds entities by name.
Parameter Type Description
name string The name
options FindOptions (Optional) Config

TrailKit.Scene.findEntitiesInRadius

function TrailKit.Scene.findEntitiesInRadius( position , radius , options ) → table[]
Finds entities within a radius.
Parameter Type Description
position vector3 Center
radius number Range
options FindOptions (Optional) Config

TrailKit.Scene.findClosestEntity

function TrailKit.Scene.findClosestEntity( position , options ) → ObjectHandle|PlayerObject|nil
Finds the closest entity to a position.
Parameter Type Description
position vector3 Center
options { (Optional) maxDistance?: number, type?: string }

TrailKit.Scene.createPool

function TrailKit.Scene.createPool( options )
Creates an object pool.
Parameter Type Description
options PoolOptions Config

TrailKit.Scene.getFromPool

function TrailKit.Scene.getFromPool( options ) → ObjectHandle
Gets an object from a pool.
Parameter Type Description
options GetPoolOptions Config

TrailKit.Scene.returnToPool

function TrailKit.Scene.returnToPool( options )
Returns an object to its pool.
Parameter Type Description
options ReturnPoolOptions Config

TrailKit.Scene.createTrigger

function TrailKit.Scene.createTrigger( options ) → table
Creates a trigger area.
Parameter Type Description
options TriggerOptions Config

TrailKit.Scene.removeTrigger

function TrailKit.Scene.removeTrigger( options )
Removes a trigger.
Parameter Type Description
options RemoveTriggerOptions Config

TrailKit.Scene.raycast

function TrailKit.Scene.raycast( options ) → {
Performs a raycast.
Parameter Type Description
options RaycastOptions Config

TrailKit.Scene.onObjectSpawned

function TrailKit.Scene.onObjectSpawned( callback )
Registers callback for when a managed object spawns.
Parameter Type Description
callback function

TrailKit.Scene.onObjectDespawned

function TrailKit.Scene.onObjectDespawned( callback )
Registers callback for when a managed object despawns.
Parameter Type Description
callback function

TrailKit.Scene.addTag

function TrailKit.Scene.addTag()
Adds a tag to a handle.

TrailKit.Scene.removeTag

function TrailKit.Scene.removeTag()
Removes a tag from a handle.

TrailKit.Scene.hasTag

function TrailKit.Scene.hasTag()
Checks if a handle has a tag.

Sound

6 functions

TrailKit.Sound.playAtPosition

function TrailKit.Sound.playAtPosition( options )
Plays a sound at a specific position.
Parameter Type Description
options SoundPlayOptions Options for playing sound

TrailKit.Sound.attach

function TrailKit.Sound.attach( options )
Attaches a looping sound to an object handle.
Parameter Type Description
options SoundAttachOptions Options for attached sound

TrailKit.Sound.stop

function TrailKit.Sound.stop( options )
Stops a specific attached sound.
Parameter Type Description
options SoundStopOptions Identifier for sound to stop

TrailKit.Sound.stopAllOnObject

function TrailKit.Sound.stopAllOnObject( options )
Stops all sounds attached to an object.
Parameter Type Description
options SoundStopAllOptions The object handle

TrailKit.Sound.getSoundNames

function TrailKit.Sound.getSoundNames() → string[]
Gets a list of all available audio names.

TrailKit.Sound.getRandomSoundName

function TrailKit.Sound.getRandomSoundName() → string|nil
Gets a random sound name.

Timer

11 functions

TrailKit.Timer.after

function TrailKit.Timer.after( options ) → string
Creates a one-shot timer.
Parameter Type Description
options TimerOptions The timer options

TrailKit.Timer.every

function TrailKit.Timer.every( options ) → string
Creates a repeating timer.
Parameter Type Description
options LoopOptions The loop options

TrailKit.Timer.cancel

function TrailKit.Timer.cancel( timerId ) → boolean
Cancels a timer by ID.
Parameter Type Description
timerId string The timer ID

TrailKit.Timer.pause

function TrailKit.Timer.pause( timerId ) → boolean
Pauses a timer by ID.
Parameter Type Description
timerId string The timer ID

TrailKit.Timer.resume

function TrailKit.Timer.resume( timerId ) → boolean
Resumes a paused timer by ID.
Parameter Type Description
timerId string The timer ID

TrailKit.Timer.getTimeRemaining

function TrailKit.Timer.getTimeRemaining( timerId ) → number|nil
Gets time remaining on a timer.
Parameter Type Description
timerId string

TrailKit.Timer.isPaused

function TrailKit.Timer.isPaused( timerId ) → boolean
Checks if a timer is paused.
Parameter Type Description
timerId string

TrailKit.Timer.cancelAll

function TrailKit.Timer.cancelAll()
Cancels all timers.

TrailKit.Timer.cancelGroup

function TrailKit.Timer.cancelGroup( groupName )
Cancels all timers in a specific group.
Parameter Type Description
groupName string The group name

TrailKit.Timer.pauseGroup

function TrailKit.Timer.pauseGroup( groupName )
Pauses all timers in a specific group.
Parameter Type Description
groupName string The group name

TrailKit.Timer.resumeGroup

function TrailKit.Timer.resumeGroup( groupName )
Resumes all timers in a specific group.
Parameter Type Description
groupName string The group name

UI

15 functions

TrailKit.UI.createLabel

function TrailKit.UI.createLabel( options )
Creates a text label UI element.
Parameter Type Description
options LabelOptions configuration

TrailKit.UI.createButton

function TrailKit.UI.createButton( options )
Creates a button UI element.
Parameter Type Description
options ButtonOptions configuration

TrailKit.UI.createInputField

function TrailKit.UI.createInputField( options )
Creates an input field UI element.
Parameter Type Description
options InputFieldOptions configuration

TrailKit.UI.updateText

function TrailKit.UI.updateText( options )
Updates the text of an existing UI element.
Parameter Type Description
options UpdateTextOptions configuration

TrailKit.UI.removeElement

function TrailKit.UI.removeElement( options )
Removes a specific UI element.
Parameter Type Description
options RemoveElementOptions configuration

TrailKit.UI.clearAll

function TrailKit.UI.clearAll( options )
Clears all UI elements for a target player(s).
Parameter Type Description
options ClearUIOptions configuration

TrailKit.UI.createSubtleMessage

function TrailKit.UI.createSubtleMessage( options )
Creates a subtle message (toast/notification) for a player.
Parameter Type Description
options SubtleMessageOptions configuration

TrailKit.UI.updateSubtleMessageText

function TrailKit.UI.updateSubtleMessageText( options )
Updates the text of a subtle message.
Parameter Type Description
options UpdateSubtleOptions configuration

TrailKit.UI.updateSubtleMessageHeader

function TrailKit.UI.updateSubtleMessageHeader( options )
Updates the header of a subtle message.
Parameter Type Description
options UpdateSubtleHeaderOptions configuration

TrailKit.UI.removeSubtleMessage

function TrailKit.UI.removeSubtleMessage( options )
Removes a subtle message.
Parameter Type Description
options RemoveSubtleOptions configuration

TrailKit.UI.showIntrusiveMessage

function TrailKit.UI.showIntrusiveMessage( options )
Shows an intrusive (center screen) message.
Parameter Type Description
options IntrusiveMessageOptions configuration

TrailKit.UI.showMenu

function TrailKit.UI.showMenu( options )
Displays a menu to the player.
Parameter Type Description
options MenuOptions configuration

TrailKit.UI.closeMenu

function TrailKit.UI.closeMenu( options )
Closes an active menu.
Parameter Type Description
options { target: any, style?: string }

TrailKit.UI.createCountdown

function TrailKit.UI.createCountdown( options ) → string
Starts a countdown on the player's screen.
Parameter Type Description
options CountdownOptions configuration

TrailKit.UI.removeCountdown

function TrailKit.UI.removeCountdown( id )
Stops/Removes a countdown.
Parameter Type Description
id string

Types & Classes

90 definitions

TrailKit

class

TrailKit.Log

class

TrailKit.Math

class

TrailKit.Event

class

TrailKit.Timer

class

TrailKit.Save

class

TrailKit.Player

class

TrailKit.Perms

class

TrailKit.Game

class

TrailKit.Sound

class

TrailKit.UI

class

TrailKit.Anim

class

TrailKit.Input

class

TrailKit.Camera

class

TrailKit.Scene

class

TrailKit.Physics

class

TrailKit.Dialogue

class

TrailKit.Bridge

class

TimerOptions

class

Fields

Name Type Description
duration number The duration of the timer
onComplete function Callback when timer completes
group string (Optional) Optional group name for the timer
useGameTime boolean (Optional) Whether to use game time or real time

LoopOptions

class

Fields

Name Type Description
interval number Time between ticks
onTick function Callback every tick
count number (Optional) Number of repetitions (-1 for infinite)
group string (Optional) Optional group name
useGameTime boolean (Optional) Whether to use game time

SaveOptions

class

Fields

Name Type Description
id string The unique save ID
data table The data to save

LoadOptions

class

Fields

Name Type Description
id string The unique save ID
default table (Optional) Default data if file not found

UpdateValueOptions

class

Fields

Name Type Description
id string The unique save ID
key string The dot-notation key to update
value any The value to set

GetValueOptions

class

Fields

Name Type Description
id string The unique save ID
key string The dot-notation key to retrieve
default any (Optional) Default value if not found

AutosaveOptions

class

Fields

Name Type Description
id string
interval number Seconds
getDataCallback function Returns table to save

PlayerObject

class

Fields

Name Type Description
id number The player's ID
name string The player's name
profileId string Persistent ID
gameObject any Native object
transform any Native transform
data table Runtime data
isPersistent boolean
isInSeat boolean
isInBuildMode boolean

SoundPlayOptions

class

Fields

Name Type Description
sound string The sound name/ID
position vector3 The position to play at

SoundAttachOptions

class

Fields

Name Type Description
handle ObjectHandle The object to attach to
sound string The sound name/ID
id string Unique ID for this sound instance

SoundStopOptions

class

Fields

Name Type Description
id string The sound instance ID to stop

SoundStopAllOptions

class

Fields

Name Type Description
handle ObjectHandle The object to quiet

LabelOptions

class

Fields

Name Type Description
id string Unique Element ID
target any The player(s) to show to
text string (Optional) text content

ButtonOptions

class

Fields

Name Type Description
id string Unique Element ID
target any The player(s) to show to
text string (Optional) Button label
callback function Click handler
data any (Optional) Data passed to callback

InputFieldOptions

class

Fields

Name Type Description
id string Unique Element ID
target any The player(s) to show to
defaultText string (Optional) Placeholder text
callback function Submit handler
data any (Optional) Data passed to callback

UpdateTextOptions

class

Fields

Name Type Description
id string Element ID
target any target player(s)
text string New text content

RemoveElementOptions

class

Fields

Name Type Description
target any target player(s)
id string Element ID to remove

ClearUIOptions

class

Fields

Name Type Description
target any target player(s)

SubtleMessageOptions

class

Fields

Name Type Description
id string (Optional) Optional ID
target any target player(s)
header string Title text
message string Body text
options SubtleMessageConfig (Optional) Extra config

SubtleMessageConfig

class

Fields

Name Type Description
duration number (Optional) Display duration
icon string (Optional) Icon name
soundOnAppear string (Optional)
soundOnDisappear string (Optional)

UpdateSubtleOptions

class

Fields

Name Type Description
id string Message ID
target any target player(s) -- Note: target arg is not strictly used in global update but kept for consistency if needed in future
message string New text

UpdateSubtleHeaderOptions

class

Fields

Name Type Description
id string Message ID
header string New header text

RemoveSubtleOptions

class

Fields

Name Type Description
id string Message ID
silent boolean (Optional) No sound

IntrusiveMessageOptions

class

Fields

Name Type Description
target any Target player(s)
header string Title
message string Body
duration number (Optional) Duration in seconds

MenuOptions

class

Fields

Name Type Description
target any Target player(s)
definition table The menu structure (root/menus for subtle, or standard def)

CountdownOptions

class

Fields

Name Type Description
id string Unique ID
target any Target player(s)
duration number Seconds
header string (Optional) Header text (subtle only)
messageFormat string (Optional) e.g. "{time} remaining"
useIntrusive boolean (Optional)
onComplete function (Optional) Callback when done
onTick function (Optional) Callback every second

TweenOptions

class

Fields

Name Type Description
handle ObjectHandle The object to anim
targetPosition vector3 (Optional) Target pos
targetRotation quaternion (Optional) Target rot
targetScale vector3 (Optional) Target scale
duration number Duration seconds
easeType string (Optional) Easing function name
onComplete function (Optional) Completion callback
loop boolean (Optional)
pingpong boolean (Optional)

PathOptions

class

Fields

Name Type Description
handle ObjectHandle The object
frames table[] List of frames {position, rotation, duration}
loop boolean (Optional) Loop path
pingpong boolean (Optional) Reverse at end
easeType string (Optional) Easing

PulseOptions

class

Fields

Name Type Description
handle ObjectHandle The object
minScale number (Optional)
maxScale number (Optional)
speed number (Optional) Speed

BobOptions

class

Fields

Name Type Description
handle ObjectHandle The object
height number (Optional) Distance
speed number (Optional) Speed

SpinOptions

class

Fields

Name Type Description
handle ObjectHandle The object
axis vector3 (Optional) Axis to spin on
speed number (Optional) Speed

ShakeOptions

class

Fields

Name Type Description
handle ObjectHandle The object
intensity number (Optional) Shake power
duration number (Optional) Duration

OrbitOptions

class

Fields

Name Type Description
handle ObjectHandle The object
center vector3 (Optional) Center point
radius number (Optional) Distance
speed number (Optional) Speed
axis vector3 (Optional) Axis

LookAtOptions

class

Fields

Name Type Description
handle ObjectHandle The object
target ObjectHandle|vector3 Target to look at
smoothing number (Optional) smoothing factor
up vector3 (Optional) Up vector

FollowOptions

class

Fields

Name Type Description
handle ObjectHandle The object
target ObjectHandle Target to follow
positionOffset vector3 (Optional)
rotationOffset quaternion (Optional)
smoothing number (Optional)
followRotation boolean (Optional)

SequenceOptions

class

Fields

Name Type Description
handle ObjectHandle Object
animations table[] List of anim defs
loop boolean (Optional) Loop sequence
pingpong boolean (Optional) Pingpong sequence
onComplete function (Optional) Callback

KBOptions

class

Fields

Name Type Description
context string (Optional) Input context

CommandOptions

class

Fields

Name Type Description
name string Command /name
callback function fn(player, args)
permission string (Optional) Required perm
description string (Optional) Help text
aliases string[] (Optional) Aliases

ContextOptions

class

Fields

Name Type Description
target any Player(s)
context string Context name

MessageOptions

class

Fields

Name Type Description
player PlayerObject Recipient
message string Content
color color (Optional) Color

CinematicOptions

class

Fields

Name Type Description
target any Player(s)
filenames string|string[] Files
speed number (Optional) Playback speed
loop boolean (Optional) Loop (Optional)
pingpong boolean (Optional)
onFinished function (Optional) Callback

CamTweenOptions

class

Fields

Name Type Description
target any Player(s)
destination vector3|ObjectHandle Target
duration number (Optional) Duration
positionOffset vector3 (Optional) Offset
lookAtOffset vector3 (Optional) Offset

CamFollowOptions

class

Fields

Name Type Description
target any Player(s)
followTarget vector3|ObjectHandle Target
positionOffset vector3 (Optional) Offset
lookAtOffset vector3 (Optional) Offset
smoothing number (Optional) smoothing

CamLookAtOptions

class

Fields

Name Type Description
target any Player(s)
lookAtTarget vector3|ObjectHandle Target
duration number (Optional) Duration
positionOffset vector3 (Optional) Offset
lookAtOffset vector3 (Optional) Offset
smoothing number (Optional) smoothing

CamOrbitOptions

class

Fields

Name Type Description
target any Player(s)
orbitTarget vector3|ObjectHandle Center
distance number (Optional) Radius
yawSpeed number (Optional) Speed
fixedPitch number (Optional) Angle
duration number (Optional)
lookAtOffset vector3 (Optional)

CamReleaseOptions

class

Fields

Name Type Description
target any Player(s)

CamPauseOptions

class

Fields

Name Type Description
target any Player(s)

CamResumeOptions

class

Fields

Name Type Description
target any Player(s)

SpawnOptions

class

Fields

Name Type Description
name string Name of object
position vector3 World pos
id string (Optional) Optional ID
group GroupHandle (Optional) Optional group
isStatic boolean (Optional) Static physics
isVisible boolean (Optional) Visibility
scale number|vector3 (Optional) scale
tags string[] (Optional)

CustomSpawnOptions

class

Fields

Name Type Description
meshName string Mesh name in assets
textureName string Texture name
position vector3 Position
id string (Optional) ID
type 'STANDARD'|'RIGIDBODY'|'CONCAVE' (Optional) Physics type

GroupOptions

class

Fields

Name Type Description
id string (Optional) ID
position vector3 (Optional) Pos
rotation quaternion (Optional) Rot
tags string[] (Optional) Tags
group GroupHandle (Optional) Parent

FindOptions

class

Fields

Name Type Description
type string (Optional) filter type

PoolOptions

class

Fields

Name Type Description
id string Pool ID
objectName string Object to pool
size number Pool size
recycleWhenExhausted boolean (Optional) Recycle (Optional)

GetPoolOptions

class

Fields

Name Type Description
id string Pool ID
spawnOptions table (Optional) Spawning overrides

ReturnPoolOptions

class

Fields

Name Type Description
handle ObjectHandle Object to return

TriggerOptions

class

Fields

Name Type Description
id string (Optional) ID
position vector3 Center
size vector3 (Optional) Size
radius number (Optional) Radius (for virtual)
onEnter function (Optional) Callback
onExit function (Optional) Callback
oneTime boolean (Optional) Trigger once (Optional)
isVisible boolean (Optional) Show debug box (Optional)
type 'AREA'|'ATTACHED'|'VIRTUAL' (Optional) Type
target ObjectHandle (Optional) (for attached)
targets table (Optional) (for virtual)

RemoveTriggerOptions

class

Fields

Name Type Description
id string Trigger ID

RaycastOptions

class

Fields

Name Type Description
origin vector3 Start
direction vector3 Dir
maxDistance number (Optional) Range
ignoreList table[] (Optional) Ignore list
filter string|table (Optional) Tag filter

ObjectHandle

class

Fields

Name Type Description
id string Unique ID
gameObject any Native LuaGameObject

ObjectMoveOptions

class

Fields

Name Type Description
targetPosition vector3 (Optional) Target
duration number Time

GroupHandle

class

Fields

Name Type Description
children table List of children handles

ForceOptions

class

Fields

Name Type Description
playerId number Owner
blueprintName string Asset
structureId string ID
position vector3 Pos
rotation quaternion Rot
force vector3 Force
forceMode string (Optional)
isLocalForce boolean (Optional)

PhysicsPathOptions

class

Fields

Name Type Description
playerId number Owner
blueprintName string Asset
structureId string ID
position vector3 Start
rotation quaternion Rot
path vector3[] Points
thrustForce number Power
steeringTorque number Turning
loop boolean (Optional) Loop (Optional)
vehicleType 'ground'|'air' (Optional) Type
pathTolerance number (Optional)

BlockWrapper

class

StructureWrapper

class

DialogueDefOptions

class

Fields

Name Type Description
id string Dialogue ID
root string First Node ID
nodes table<string,DialogueNode> Nodes
trigger DialogueTrigger (Optional) Trigger

DialogueStartOptions

class

Fields

Name Type Description
target any Player(s)
dialogueId string ID
lookAt vector3|ObjectHandle (Optional) Focus

DialogueMessage

class

Fields

Name Type Description
header string Title
text string Body
icon string (Optional)

DialogueEndOptions

class

Fields

Name Type Description
target any Player(s)
message DialogueMessage (Optional) Message

DialogueNode

class

Fields

Name Type Description
text string The text to display
options DialogueOption[] (Optional) List of player response options
leadsTo string (Optional) Key of the next node (if no options)
onEnter function (Optional) Callback when node is entered
onLeave function (Optional) Callback when node is left

DialogueOption

class

Fields

Name Type Description
text string text to display
leadsTo string (Optional) Key of the next node
onSelect function (Optional) Callback when option is selected

DialogueTrigger

class

Fields

Name Type Description
position vector3 (Optional) Static position
attachToId string (Optional) Attach to object by ID
size vector3 (Optional) Trigger size
isVisible boolean (Optional)
oneTime boolean (Optional)

Documentation sourced from Alvaroping's LuaLS Library.