Client

Library
Updated 2 months ago · v1.3.7

lib.registerGroupTask

Register a task that can be started by the group leader from the server. When the server calls lib.startGroupTask, the execute callback runs on every group member's client.

lua
lib.registerGroupTask(id, data)
ParameterTypeRequiredDescription
idstringyesUnique task identifier (must match the server-side task ID)
datatableyesTask definition

Task Data

FieldTypeDescription
executefunction(args)Called when the task starts on this client. Receives the args passed from startGroupTask
killfunction(args)Called when the task is ended via endGroupTask

Example

lua
lib.registerGroupTask('clean_cars', {
    execute = function(args)
        -- Runs on every group member's client
        print('Task started at zone:', args.zone)
    end,
    kill = function(args)
        -- Cleanup when task ends
        print('Task ended')
    end,
})
Was this page helpful?
This page was last updated on 12 March 2026
DIRKSCRIPTS
All you need for your FiveM server.10% off your first order

Unsubscribe any time.

Copyright © 2026 DirkScripts. Not affiliated with or endorsed by Rockstar North or Take-Two Interactive.