Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Add an Announcement Script to a FiveM Server (Lua 5.4 Guide)

Build and load a Lua 5.4 FiveM resource that sends permission-protected announcements to every connected player.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The reliable way to add announcements in FiveM is to create a resource folder containing an fxmanifest.lua file and a Lua script. Use the client event chat:addMessage for a message shown only to one client, or call the server-side exports.chat:addMessage(-1, ...) export to broadcast it to every connected player.

This guide builds a small, permission-protected announcement resource, loads it without shutting down FXServer, explains how the default NUI chat resource handles the message, and shows what to check when a custom chat system or permissions configuration changes the result.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What an announcement script is in FiveM

FiveM treats scripts as resources. A resource is a directory under the server’s resources directory. FiveM recognizes that directory when it contains a resource manifest named fxmanifest.lua (older resources may use the former __resource.lua name). The manifest declares which client and server Lua files should be loaded.

For a simple announcement tool, the resource normally has three parts:

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  • A manifest: fxmanifest.lua, which identifies the game and lists the scripts.
  • A server script: code that accepts an administrator command and broadcasts the resulting text.
  • An optional client script: code that displays a local test or client-only notice.

The examples below target GTA V with fx_version 'cerulean'. Current FiveM Lua guidance uses Lua 5.4: Cfx.re’s manifest reference states that, as of June 2025, Lua 5.3 was deprecated and all Lua scripts use version 5.4. That matters when you copy older examples or combine this resource with an old server pack.

Before you create the resource

Access and files you need

  • Access to the FXServer installation and its resources directory.
  • Permission to create a folder and edit text files on the server.
  • Access to the FXServer console so you can run refresh, start, and restart.
  • A running default chat resource for the examples in this guide.

The default chat resource is part of the cfx-server-data set and uses a NUI-based interface. These examples call its documented event and export. If the server replaces that resource with a custom chat or NUI, the event names, export names, and message object may be different; check that system’s API before troubleshooting the Lua shown here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a resource name

Use a short name with no spaces, such as announcement. The name is used in console commands, so the directory name and the name you start must match exactly.

Step 1: Create the resource folder

Inside the FXServer installation, create this path:

resources/[local]/announcement/

The bracketed [local] directory is simply a category for resources you maintain yourself. You can use another category or place announcement directly under resources; what matters is that FiveM can find the folder and that the folder contains fxmanifest.lua.

For the complete version of the resource, the folder will contain:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
resources/
└── [local]/
    └── announcement/
        ├── fxmanifest.lua
        ├── client.lua
        └── server.lua

File names are case-sensitive on many hosting systems. Save the files with the exact names shown, rather than accidentally creating fxmanifest.lua.txt in a text editor.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Step 2: Add the resource manifest

Create fxmanifest.lua in the announcement folder and add:

fx_version 'cerulean'
game 'gta5'

author 'Your name'
description 'Server announcements'
version '1.0.0'

client_script 'client.lua'
server_script 'server.lua'

fx_version 'cerulean' selects the current FXv2 manifest version documented by Cfx.re, while game 'gta5' selects FiveM’s GTA V API set. The author, description, and version fields identify the resource for people maintaining the server; they do not implement the announcement itself.

The two script declarations have different execution contexts. client_script loads code for each connected player, and server_script loads code in the server process. Keeping the broadcast command in the server script prevents an ordinary client from deciding to run the server’s broadcast operation directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Step 3: Display a local announcement with chat:addMessage

Put this in client.lua:

TriggerEvent('chat:addMessage', {
  color = {255, 200, 0},
  multiline = true,
  args = {'ANNOUNCEMENT', 'Welcome to the server!'}
})

This calls the documented chat:addMessage client event. The message object shown here contains a color triplet, the multiline flag, and an args array. The first argument labels the message as ANNOUNCEMENT; the second is the text that appears after that label.

A client-triggered event is visible only to the client that executes it. That makes this form useful for a welcome notice, a local diagnostic, or testing whether the chat resource is rendering messages. It is not a server-wide broadcast. If every player must see the text, put the broadcast code in server.lua as described next.

Step 4: Broadcast to every connected player from the server

FiveM’s documented server export accepts a target and a message object. A target of -1 means all players:

exports.chat:addMessage(-1, {
  color = {255, 200, 0},
  multiline = true,
  args = {'ANNOUNCEMENT', 'Scheduled restart in 10 minutes.'}
})

Because this is a server export, the server chooses the target and sends the message through the running chat resource. Replace -1 with a specific player target when your server logic needs to address one player; the all-player value is the documented pattern for a broadcast.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Add an administrator command

To let an authorized administrator write the announcement at runtime, put this in server.lua:

RegisterCommand('announce', function(source, args)
  local message = table.concat(args, ' ')
  if message == '' then return end

  exports.chat:addMessage(-1, {
    color = {255, 200, 0},
    multiline = true,
    args = {'ANNOUNCEMENT', message}
  })
end, true)

After the resource is running, an authorized user can enter a command such as:

/announce Scheduled restart in 10 minutes.

RegisterCommand receives the command source and the words entered after the command. table.concat(args, ' ') joins those words back into one sentence, preserving spaces between them. The empty-string check prevents a blank line from being broadcast when somebody enters /announce without text.

The final argument, true, marks the command as restricted. In practice, the command must be allowed by the server’s ACE permission configuration before it can be used. The FiveM documentation establishes the restriction behavior but does not prescribe one universal ACE policy, so grant it according to the administration model already used on your server. Do not remove the restriction merely to make testing easier on a public server; use a controlled test environment or configure the appropriate permission first.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Step 5: Load and reload the resource

Creating or editing files does not automatically load them into a running FXServer. Use the server console in this order:

  1. Save fxmanifest.lua, client.lua, and server.lua in the announcement folder.
  2. Run refresh. This makes FXServer rescan the resources directory and notice a newly created manifest or changed resource metadata.
  3. Run start announcement. The resource name must match the folder name.
  4. Connect a test client and run /announce Test announcement from an account that has the required permission.
  5. During later edits, run restart announcement to reload this resource without closing the server.

If the resource was already running when you changed only a Lua file, restart announcement is the practical development loop. If you added or renamed the manifest or created the resource directory after the server started, run refresh before starting it. Watch the console for a resource-start error rather than assuming a silent chat failure means the code was accepted.

How the two message paths differ

Use case API Execution context Who sees the message
Show a local notice or test TriggerEvent('chat:addMessage', message) Client The client that triggered the event
Broadcast an announcement exports.chat:addMessage(-1, message) Server Every connected player targeted by -1
Address one player exports.chat:addMessage(target, message) Server The player represented by the target value

Both forms pass a message object. The documented object supports template, color, multiline, and args. The examples use color, multiline, and args because they are enough for a labeled announcement. A custom template can be used when the chat resource supports the corresponding template data, but its markup and styling are controlled by that chat implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

The older chatMessage event should not be used for new code. Cfx.re documents chat:addMessage as the preferred replacement, and the default chat resource is built around its NUI interface.

Permission and command design

Why the restriction flag matters

The command’s true restriction is the boundary between “any connected player can broadcast” and “the server’s permission system decides who may broadcast.” The Lua file alone does not define which administrators qualify. Your ACE configuration, inherited groups, and existing administration rules determine that decision.

Test three cases separately: an authorized administrator should receive a successful broadcast, a normal player should be denied, and an empty command should produce no chat line. Testing only with an administrator can hide an accidental permission change.

Keep broadcasting on the server

Do not move the all-player export into a client script and assume it becomes authoritative. The local event is intentionally client-scoped. The server script is the appropriate place to validate the command, assemble the text, and choose the target. This also leaves one clear location for later additions such as logging or a more specific permission check.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the message payload predictable

Use a stable label such as ANNOUNCEMENT and keep the actual text in one argument. The predictable shape makes it easier to change the color, switch to a template, or replace the chat resource later. The supplied examples use a yellow-toned color triplet, but the exact appearance ultimately depends on the active chat resource’s styling.

Custom chat, NUI, and framework compatibility

The default chat resource is a NUI-based interface included with cfx-server-data. The resource in this guide assumes that implementation is running and that its documented event and export are available.

A server may instead use a custom chat/NUI resource or a framework-specific messaging layer. In that case, the announcement folder can still be structurally correct while no text appears, because the replacement may:

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  • Use a different event name than chat:addMessage.
  • Expose a different server export or no export at all.
  • Expect a different message table, template format, or argument order.
  • Render messages outside the standard chat window.

Confirm which chat resource is running before changing the Lua. If the replacement documents an adapter, update only the call that sends the message; the manifest and command-permission structure can remain separate. Do not run two competing chat implementations merely to make this example work, because the visible result and event ownership can become ambiguous.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting by symptom

“Could not find resource” or the resource never starts

  • Confirm the directory is actually under the server’s resources directory.
  • Check that the folder name is exactly announcement if you are running start announcement.
  • Check the manifest spelling: it must be fxmanifest.lua, not a text-file extension appended by the editor.
  • Run refresh, then run start announcement again.
  • Read the console’s resource error before changing code; a manifest parse error prevents either Lua script from loading.

The command exists, but no chat line appears

  • Verify the default chat resource is running. The examples depend on it.
  • Check that you used the server export for a broadcast, not only the client event.
  • Confirm the message text is not empty after table.concat.
  • If the server uses a custom chat/NUI, compare its event, export, and payload schema with this guide.
  • Restart the resource after editing Lua files so the server is executing the current version.

Only the person testing sees the message

This normally means the client event was triggered. TriggerEvent('chat:addMessage', ...) is documented as a message to the executing client. Move the announcement call to server.lua and use exports.chat:addMessage(-1, ...) for an all-player target.

The command is denied for an administrator

The final true parameter deliberately restricts the command. Check the server’s ACE configuration and the account’s group or identifier assignment. The script does not contain a universal permission rule, so the fix belongs in the server’s existing permission model rather than in the message payload.

Edits appear to have no effect

Save the file in the resource directory, run restart announcement, and test again. If you changed the manifest or created the resource after startup, run refresh first. Also check that you are editing the copy of the resource that the running server actually loads; duplicate folders with the same intended name can lead to changes being made in the wrong location.

Hand-written resource or packaged announcement resource?

A small hand-written resource is transparent: you can see the command, payload, and permission boundary in a few files. A packaged resource may add scheduling, configuration screens, or a different user interface, but those details vary by package and must be verified against its documentation. Compare the options using the criteria below rather than assuming that a larger package uses the default chat API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision point Hand-written resource Packaged resource
Broadcast scope and permissions Explicit in server.lua; you choose the target and rely on the server’s ACE policy. May provide its own commands or permission settings; verify whether it uses ACE and how it maps targets.
Chat dependency These examples depend on the default chat event/export. May depend on the default chat resource, a custom NUI, or an included interface.
Configuration and scheduling The shown code provides an on-demand command; additional behavior must be implemented deliberately. May include configuration or scheduling, but the available features are package-specific.
Lua/runtime compatibility The manifest and scripts shown here follow current Lua 5.4 guidance. Check its manifest and code for Lua 5.4 compatibility, especially if it was written for an older runtime.
Licensing and updates You control the files and their maintenance. Review the package’s license, update policy, and support terms before installing it.

If all you need is a labeled message that an authorized administrator can broadcast, the short resource above avoids an additional dependency. If you require features beyond that scope, verify the package’s chat integration and permission behavior before replacing a known-working resource.

Production checklist

  • Folder: the resource is under resources and has a unique, space-free name.
  • Manifest: fxmanifest.lua uses fx_version 'cerulean', game 'gta5', and declares the scripts that actually exist.
  • Runtime: Lua code is written for the current Lua 5.4 guidance rather than copied unchanged from a Lua 5.3 example.
  • Chat: the default chat resource is running, or your custom chat’s event/export and payload have been substituted.
  • Scope: local notices use chat:addMessage; server-wide notices use the server export with target -1.
  • Permissions: the command remains restricted with the final true argument and is tested with both allowed and denied accounts.
  • Lifecycle: you run refresh when the resource or manifest is newly discovered, start announcement to launch it, and restart announcement after code edits.
  • Failure handling: empty announcements are ignored and console errors are checked before changing unrelated code.

Minimal files to copy

For reference, these are the three files in one place. Save each block under the path shown, then refresh and start the resource.

fxmanifest.lua

fx_version 'cerulean'
game 'gta5'

author 'Your name'
description 'Server announcements'
version '1.0.0'

client_script 'client.lua'
server_script 'server.lua'

client.lua

TriggerEvent('chat:addMessage', {
  color = {255, 200, 0},
  multiline = true,
  args = {'ANNOUNCEMENT', 'Welcome to the server!'}
})

server.lua

RegisterCommand('announce', function(source, args)
  local message = table.concat(args, ' ')
  if message == '' then return end

  exports.chat:addMessage(-1, {
    color = {255, 200, 0},
    multiline = true,
    args = {'ANNOUNCEMENT', message}
  })
end, true)

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.