Creating Scripts

Create your first script in FiveM.

Creating a script with Visual Studio Code

1. Navigate to your server files

  1. Open File Explorer on your Desktop and navigate to the txData folder.
  2. Double-click the folder named FiveMBasicServerCFXDefault_AB1234.base or something similar.
  3. Double-click the resources folder located in the folder you opened.

2. Create script folder and files

  1. Create a new folder in resources named helloWorld.
  2. Open helloWorld and create two new text files:
    • client.lua
    • fxmanifest.lua

3. Write the manifest file

  1. Open fxmanifest.lua in Visual Studio Code and paste the following code in the file:
fx_version 'cerulean'
game 'gta5'
author 'YourName'
description 'My first hello world script'
version '1.0.0'
client_script 'client.lua'
  1. Save the file.

4. Write the client script

  1. Open client.lua in Visual Studio Code.
  2. Paste this code:
print('helloWorld')
  1. Save the file.

5. Run the script in FiveM

  1. In FiveM, press F8 to open the console.
  2. Type tx and press Tab twice to open the txAdmin sub menu.
  3. Go to Resources > Reload & Refresh.
  4. Use the search bar to look for helloWorld.
  5. Click Start next to the helloWorld script.

6. Verify the script is working

Press F8. helloWorld prints in the console.

You’ve successfully set up your server and run your first Lua script in FiveM. While simple, this script is the first step toward building more advanced resources for your server.

Next Steps

Guides

Exploring the FiveM native reference

A crucial part of the documentation around FiveM is the native reference which allows you to interact with game functions. Let’s explore some of the simple to use natives first and incorporate them into your first script.

Disabling the minimap

While the minimap helpful it is not wanted in some cases so let’s disable it:

  1. Open the native reference and try finding the DisplayRadar native.
  2. Go to the helloWorld folder and double-click on client.lua and remove everything inside.
  3. Type the following text:
DisplayRadar(false)
  1. Hit Ctrl + S or go to File > Save to save your file.
  2. Start up the game and restart the helloWorld script via the txAdmin Resource tab. The minimap is hidden. On the native reference you can find more interesting game functions which can be combined to create unique experiences and gameplay twists.
Spawning a vehicle guide
  1. Open the native reference and try finding the CreateVehicle native.
  2. Navigate to helloWorld and open client.lua and remove everything inside.
  3. Copy the example from the native reference to your client.lua.
  4. Hit Ctrl + S or go to File > Save to save your file.
  5. Start up the game and restart the helloWorld script via the txAdmin Resource tab. A car is spawned. For example, an Adder vehicle is spawned.

Feel free to play around with other vehicles which you can find in the vehicle reference.

Where to learn more?

The official forum and the official Discord server are great places to look at other people’s releases, learn from them, or ask members of the community for help. Within the forum, go to the Resource Development & Modding category for learning about resource creation.

For questions regarding server setup or general troubleshooting, go to Server Development category.

Want to see what other people made?

While there is a dedicated #showcase channel in our Discord server check out the FiveM Releases in our forum which can be a great inspiration for your own projects.

Last modified November 5, 2025: tweak: various tweaks (5c841b4)