FiveM Development Tutorial 2025 - Complete Guide for Beginners
⏱️ Estimated Time: 60-90 minutes | 🎯 Difficulty: Beginner | 📚 Step-by-Step Learning Path
Welcome to the most comprehensive FiveM development tutorial for 2025! This guide will take you from zero to creating your first custom FiveM server with QBCore framework. Whether you’re completely new to FiveM or looking to upgrade your skills, this tutorial has everything you need.
What You’ll Learn: By the end of this tutorial, you’ll have a fully functional FiveM server running QBCore framework and understand the fundamentals of FiveM development.
What is FiveM Development?
FiveM development involves creating custom game modes, servers, and modifications for Grand Theft Auto V using the FiveM modification framework. It allows developers to:
- Create Custom Servers: Build unique roleplay experiences
- Develop Resources: Custom scripts and game modifications
- Manage Communities: Admin tools and player management systems
- Monetize Projects: Create revenue through server donations
Why Choose QBCore for FiveM Development?
Feature | QBCore Advantage | Developer Benefit |
---|---|---|
Modern Architecture | ✅ Clean, maintainable codebase | Faster development cycles |
Built-in Features | ✅ Jobs, inventory, phone system | Less custom coding required |
Active Community | ✅ Regular updates & support | Reliable long-term solution |
Performance | ✅ Optimized for large servers | Better player experience |
Documentation | ✅ Comprehensive guides | Easier learning curve |
Prerequisites & Requirements
Before we begin, ensure you have:
System Requirements
- Operating System: Windows 10+ or Linux (Ubuntu 18.04+)
- RAM: Minimum 8GB (16GB recommended)
- Storage: At least 10GB free space
- Internet: Stable connection for downloads
🛠️ Development Hardware Recommendations
Want the best FiveM development experience? Here’s what we recommend:
Development Setup Essentials
For optimal FiveM development, consider:
- High-performance SSD: Faster loading and compilation times
- 16GB+ RAM: Handle multiple development tools and test servers
- Modern CPU: Better performance for code compilation and testing
Learning Resources
Perfect for beginners starting their development journey:
- Programming fundamentals books
- Online coding courses and tutorials
Pro Tip: A good mouse and mechanical keyboard make coding sessions much more comfortable during long development sessions!
Required Software
- FiveM Server Files: Latest version
- Database: MySQL or MariaDB
- Code Editor: VS Code (recommended)
- Git: For version control
- Steam Account: For FiveM license key
Knowledge Prerequisites
- Basic Programming: Understanding of variables and functions
- Command Line: Basic terminal/command prompt usage
- Text Editing: Comfortable with code editors
Important: Never use pirated or cracked versions of GTA V. FiveM requires a legitimate copy of the game.
Step 1: Setting Up Your Development Environment
Download & Install Required Software
Install Code Editor
Download and install VS Code with essential extensions:
# Recommended VS Code Extensions
- Lua Language Server
- FiveM Natives
- GitLens
- Code Spell Checker
Install Database Server
Install XAMPP (Recommended for beginners):
- Download from xampp.apache.org
- Run installer as administrator
- Select MySQL and Apache components
- Start MySQL service from XAMPP panel
Install Git Version Control
- Download from git-scm.com
- Run installer with default settings
- Verify installation:
git --version
Step 2: Download & Setup FiveM Server
Get FiveM Server Files
Create Project Directory
mkdir fivem-server
cd fivem-server
Download Server Files
- Visit runtime.fivem.net
- Download latest server build
- Extract to your project directory
Get FiveM License Key
- Visit keymaster.fivem.net
- Register/login with your account
- Create new server key
- Copy the generated license key
Configure Basic Server
Create server.cfg
file in your server directory:
# Server Information
sv_hostname "^7My FiveM Development Server ^3[QBCore]"
sv_projectName "FiveM Development Server"
sv_projectDesc "Learning FiveM Development with QBCore"
# Server Settings
sv_maxclients 32
sv_endpointprivacy true
sv_listing_type "private" # Change to "public" when ready
# License Key (REPLACE WITH YOUR KEY)
sv_licenseKey "YOUR_LICENSE_KEY_HERE"
# Database Connection (Update with your MySQL details)
set mysql_connection_string "mysql://root:password@localhost/qbcore?charset=utf8mb4"
# Essential Resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
ensure baseevents
# QBCore Resources (We'll add these after installation)
Security Note: Never share your license key publicly or commit it to version control. Consider using environment variables in production.
Step 3: Install QBCore Framework
Download QBCore
Clone QBCore Repository
cd resources
git clone https://github.com/qbcore-framework/qb-core.git [qb-core]
Install Essential Resources
# Core Framework Components
git clone https://github.com/qbcore-framework/qb-multicharacter.git [qb-multicharacter]
git clone https://github.com/qbcore-framework/qb-spawn.git [qb-spawn]
git clone https://github.com/qbcore-framework/qb-hud.git [qb-hud]
git clone https://github.com/qbcore-framework/qb-inventory.git [qb-inventory]
git clone https://github.com/qbcore-framework/qb-menu.git [qb-menu]
Setup Database
- Open your database management tool (phpMyAdmin for XAMPP users)
- Create new database named
qbcore
- Import the SQL files from
qb-core/import.sql
Update Server Configuration
Add QBCore resources to your server.cfg
:
# QBCore Framework
ensure qb-core
ensure qb-multicharacter
ensure qb-spawn
ensure qb-hud
ensure qb-inventory
ensure qb-menu
# Additional QBCore Resources
ensure qb-vehiclekeys
ensure qb-garages
ensure qb-fuel
ensure qb-shops
ensure qb-banking
Step 4: First Server Launch & Testing
Start Your Server
# Navigate to server directory
cd C:\path\to\your\fivem-server
# Start server
run.cmd +exec server.cfg
Connect to Your Server
- Open FiveM client
- Go to “Play” → “Connect”
- Enter:
localhost:30120
- Click “Connect”
Success Indicators:
- Server starts without errors
- You can connect and spawn in-game
- Character creation system appears
- Basic QBCore features work (inventory, phone, etc.)
Step 5: Understanding FiveM Development Basics
Resource Structure
Every FiveM resource follows this structure:
resource-name/
├── fxmanifest.lua # Resource configuration
├── config.lua # Settings and options
├── server/
│ └── main.lua # Server-side code
├── client/
│ └── main.lua # Client-side code
├── shared/
│ └── shared.lua # Code available on both sides
└── html/ # UI files (optional)
├── index.html
├── style.css
└── script.js
Your First Custom Resource
Let’s create a simple “Hello World” resource:
Create Resource Directory
cd resources
mkdir [hello-world]
cd [hello-world]
Create fxmanifest.lua
fx_version 'cerulean'
game 'gta5'
name 'hello-world'
description 'My first FiveM resource'
author 'Your Name'
version '1.0.0'
client_scripts {
'client/main.lua'
}
server_scripts {
'server/main.lua'
}
Create Server Script
Create server/main.lua
:
-- Server-side code runs on the server
print("^2[Hello World] ^7Server-side script loaded successfully!")
-- Register a server event
RegisterServerEvent('hello-world:serverTest')
AddEventHandler('hello-world:serverTest', function()
print("^3[Hello World] ^7Server event triggered by player: " .. GetPlayerName(source))
end)
-- Register a command
RegisterCommand('hello', function(source, args, rawCommand)
if source == 0 then
print("^5[Hello World] ^7Hello from server console!")
else
TriggerClientEvent('hello-world:clientResponse', source, "Hello from server!")
end
end, false)
Create Client Script
Create client/main.lua
:
-- Client-side code runs on each player's game
print("^2[Hello World] ^7Client-side script loaded successfully!")
-- Register client event
RegisterNetEvent('hello-world:clientResponse')
AddEventHandler('hello-world:clientResponse', function(message)
print("^4[Hello World] ^7Received message: " .. message)
-- Show notification to player
SetNotificationTextEntry("STRING")
AddTextComponentString(message)
DrawNotification(false, false)
end)
-- Trigger server event when player spawns
AddEventHandler('onClientResourceStart', function(resourceName)
if resourceName == GetCurrentResourceName() then
TriggerServerEvent('hello-world:serverTest')
end
end)
Add Resource to Server
Add to your server.cfg
:
ensure hello-world
Test Your Resource
- Restart your server or use
refresh
andensure hello-world
in server console - Connect to your server
- Type
/hello
in chat - Check both server console and game for messages
Congratulations! You’ve created your first FiveM resource. This demonstrates the basic client-server architecture that powers all FiveM development.
Step 6: QBCore Integration Basics
Understanding QBCore Structure
QBCore provides several key objects and functions:
-- Get QBCore object (use in any script)
local QBCore = exports['qb-core']:GetCoreObject()
-- Common QBCore functions
local Player = QBCore.Functions.GetPlayer(source) -- Get player object
local PlayerData = QBCore.Functions.GetPlayerData() -- Get client player data
QBCore.Functions.Notify("Hello!", "success") -- Show notification
Creating a QBCore Resource
Let’s modify our hello-world resource to use QBCore:
Update client/main.lua
:
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('hello-world:clientResponse')
AddEventHandler('hello-world:clientResponse', function(message)
-- Use QBCore notification instead of GTA notification
QBCore.Functions.Notify(message, "success", 3000)
end)
Update server/main.lua
:
local QBCore = exports['qb-core']:GetCoreObject()
RegisterCommand('hello', function(source, args, rawCommand)
if source == 0 then
print("^5[Hello World] ^7Hello from server console!")
else
local Player = QBCore.Functions.GetPlayer(source)
if Player then
local playerName = Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname
TriggerClientEvent('hello-world:clientResponse', source, "Hello " .. playerName .. "!")
end
end
end, false)
Step 7: Essential Development Tools & Tips
Debugging Tools
Monitor server-side errors and print statements
Server ConsoleAccess client-side console for debugging
F8 Console (In-Game)Use browser dev tools to debug NUI issues
Network MonitorphpMyAdmin, MySQL Workbench for database management
Database ToolsCommon Development Commands
# Server console commands
refresh # Reload all resources
ensure [resource-name] # Start specific resource
stop [resource-name] # Stop specific resource
restart [resource-name] # Restart specific resource
# In-game commands (if you have admin permissions)
/dev # Toggle development mode
/coords # Get current coordinates
/car [vehicle-name] # Spawn vehicle
Performance Best Practices
- Efficient Event Usage: Don’t spam server events
- Proper Threading: Use
Wait()
in loops to prevent blocking - Resource Cleanup: Clean up blips, entities, and events
- Minimal Database Queries: Cache frequently accessed data
- Optimized Loops: Avoid unnecessary iterations
-- Bad: Blocking loop
while true do
-- This will freeze the server/client
DoSomething()
end
-- Good: Non-blocking loop with wait
CreateThread(function()
while true do
DoSomething()
Wait(1000) -- Wait 1 second between iterations
end
end)
Step 8: Next Steps & Resources
Continue Learning
⏱️ 45 mins | Master Lua programming specific to FiveM development
Lua Scripting for FiveM⏱️ 30 mins | Understand QBCore’s internal structure and design patterns
QBCore Architecture⏱️ Varies | Jobs, inventory, UI development, and more
Advanced QBCore Features⏱️ 15 mins | Detailed framework comparison and migration guide
QBCore vs ESX ComparisonReady-Made Resources
Save development time with professional QBCore resources:
Accelerate Your Development: Check out FiveMX QBCore Scripts for production-ready resources including advanced job systems, unique activities, and custom features.
Complete Server Solutions: Get started faster with FiveMX QBCore Server Packs - fully configured servers with all essential resources pre-installed.
Essential Documentation
- QBCore Installation Guide - Detailed installation instructions
- QBCore Functions Reference - Complete API documentation
- Resource Development Guide - Advanced scripting techniques
- Database Schema - Understanding QBCore’s data structure
Community & Support
- GitHub Discussions - Official QBCore community
- QBCore Discord - Real-time help and discussions
- Support Page - Direct support channels and troubleshooting
Common Issues & Solutions
Server Won’t Start
Problem: Server crashes or won’t start Solutions:
- Check
server.cfg
syntax for errors - Verify MySQL connection string
- Ensure license key is valid
- Check resource dependencies
Can’t Connect to Server
Problem: Connection timeout or failed Solutions:
- Verify server is running (check console)
- Check firewall settings (port 30120)
- Ensure IP address is correct
- Try
localhost:30120
for local testing
Resource Errors
Problem: Custom resources not working Solutions:
- Check
fxmanifest.lua
syntax - Verify file paths in manifest
- Look for Lua syntax errors in console
- Ensure resource is added to
server.cfg
Database Connection Issues
Problem: MySQL connection errors Solutions:
- Verify MySQL server is running
- Check connection string credentials
- Ensure database exists
- Import required SQL files
Congratulations! You’ve completed the FiveM Development Tutorial. You now have a solid foundation to start creating amazing FiveM servers and resources with QBCore framework.
What’s Next?
- Practice: Experiment with the code examples and create variations
- Explore: Browse existing QBCore resources to understand different patterns
- Build: Start your first real project - maybe a custom job or activity
- Connect: Join the QBCore community and share your progress
- Level Up: Move on to intermediate tutorials for advanced features
Ready to dive deeper? Continue your journey with our Lua Scripting for FiveM tutorial, or explore our complete QBCore vs ESX comparison to understand why QBCore is the right choice for your project.