Making a timer only run once?

private void OnServerCommand()
{
timer.Every(3f, () =>
{
Puts("Test message");
});
}

I want it to perform a function within the specified delay interval, but it transmits the same message repeatedly after the timeout expires

timer.Every is a repeating timer after set amount of seconds.

If you want only a single delay, use timer.Once instead.

private void OnServerCommand()
{
timer.Once(10f, () =>
{
Puts("TEST");
});
}
}

result:

https://imgyukle.com/i/sa.RvJd3n


loading, 10 seconds and after spam
Unless you are reloading your plugin, that code above with timer.Once would not cause it to "spam" or repeat; it'd only be called after 10 seconds when you run a command. Perhaps you are misunderstanding the purpose of OnServerCommand?