If prompted about file extensions, click Yes to confirm.
fx_version 'cerulean'
game 'gta5'
author 'YourName'
description 'My first hello world script'
version '1.0.0'
client_script 'client.lua'
print('helloWorld')
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 helpful it is not wanted in some cases so let's disable it:
DisplayRadar(false)
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.