If prompted about file extensions, click Yes to confirm.
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'
Save the file.
Open client.lua in Visual Studio Code.
Paste this code:
print('helloWorld')
Save the file.
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.
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.
While the minimap is helpful it is not wanted in some cases so let's disable it:
Open the native reference and try finding the DisplayRadar native.
Go to the helloWorld folder and double-click on client.lua and remove everything inside.
Type the following text:
DisplayRadar(false)
Hit Ctrl + S or go to File > Save to save your file.
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.
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.
To use a different vehicle in the script you just created just replace adder with a vehicle name that you like.
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.