Used to create a timer that will trigger a function every x amount of milliseconds. In the usage example the function is being triggered every 5000ms.

The callback function is not immediately invoked. Meaning you have to wait x amount of milliseconds for the first call of the function.

Returns a number reference which can be used to clear the interval.


alt.setInterval(handler: (...args: any[]) => void, miliseconds: number): number


alt.setInterval(someCallbackFunction, 5000);

Real World Example

function someCallbackFunction() {
     alt.log('Timer Says Hello!');


These examples assume you have imported alt from alt-client.

results matching ""

    No results matching ""