Agency Docs
Standalone

Agency-Seatbelt V2 Exports & API

Standalone seatbelt that buckles itself in self-driving cars, ejects unbuckled drivers on impact, and ships with five.

v2.0.0Paid4 Pages

01Client Exports

ExportDescription
isSeatbeltOn()Returns true while the local player's belt is fastened, no matter whether they buckled up themselves or the car did it.
enableSeatbelt()Fastens the local player's belt with the usual sound and feedback.
disableSeatbelt()Releases the local player's belt with the usual sound and feedback.
toggleSeatbelt()Switches the local player's belt. Returns true when the state actually changed, not the new state, so a toggle that was refused (no vehicle, or no belt in this seat) can be told apart from one that worked.
isAutoBuckled()Returns true while the belt was fastened by the car and not by the player.
autoBuckle(on: boolean)Fastens or releases the belt as an automatic belt, the same way a self-driving car does.
getSeatbeltState()Returns a table with the fastened state, whether it is automatic, the seat and the vehicle.
setSeatbeltEnabled(on: boolean)Turns the whole seatbelt off or on for this player, for cutscenes or admin situations.
isPlayerSeatbeltOn(serverId: number)Returns another player's belt state, read from the replicated state bag.
bucklesItselfVehicle(vehicle: number)Returns whether this vehicle buckles its occupants itself, by model list or by the agAuto state bag.
openSettings()Opens the settings card.
closeSettings()Closes the settings card.
isSettingsOpen()Returns whether the settings card is open.

02Server Exports

ExportDescription
isSeatbeltOn(source: number)Returns a player's belt state on the server, read from the replicated state bag.
getBuckledPlayers()Returns the server ids of every player currently buckled up.
setSeatbelt(source: number, on: boolean)Fastens or releases a player's belt from the server.

03Events

NameSideDescription
Agency-HUD:seatbeltStateChangedClientFires on every change with the new state. Agency-HUD listens for it; any other resource may too.

+Good to know

This page lists the available exports provided by Agency-Seatbelt for use in other resources. Developers can use these client-side exports to control or query the seatbelt state for the local player. No server-side exports are provided. Ensure Agency-Seatbelt is started before any resource that uses its exports to avoid runtime errors or undefined behavior.

Client-side exports only
Agency-Seatbelt provides four exports that are all client-side. These allow scripts to enable, disable, toggle, or check the seatbelt status for the local player. There are no server exports or events exposed by this resource.
Usage within other resources
To use these exports, ensure Agency-Seatbelt is started before any dependent resource. Call the exports directly from your client scripts to integrate seatbelt functionality or HUD status checks as needed.
No dependencies or SQL
Agency-Seatbelt does not require any external dependencies or SQL setup. All features, including export functions, are available out of the box after starting the resource.

?Frequently asked questions

Are there any server-side exports available for Agency-Seatbelt?

No, Agency-Seatbelt only provides client-side exports. There are no server exports or events exposed. All interaction with seatbelt state must be performed from client scripts using the available exports.

What happens if I call an export before Agency-Seatbelt is started?

If you attempt to use an export before Agency-Seatbelt is started, the export will not be available and your script may throw an error or fail to function as expected. Always ensure Agency-Seatbelt is started first.

Do I need to configure any dependencies or import SQL to use these exports?

No, Agency-Seatbelt does not require any dependencies or SQL imports. The exports are available immediately after the resource is started, and no additional setup is necessary.

How do I check if the local player's seatbelt is buckled from another script?

You can use the isSeatbeltOn() client export to check if the local player's seatbelt is currently buckled. Call this export from your client script to retrieve the current seatbelt status.

Still stuck after this page? Our support team takes it from here.