FiveMLuaParticle FXLoopedTutorial
How to use Looped Particle FX in FiveM (Continuous Effects)
March 25, 2026
2 min read
61 views
How to use Looped Particle FX in FiveM
Looped Particle Effects are effects that continuously work until stopped — suitable for car smoke, fire, sparks, steam or various aura effects.
Native Functions for Looped
-- play at coordinates — return handle
local handle = StartParticleFxLoopedAtCoord(
effectName,
x, y, z,
rotX, rotY, rotZ,
scale,
xAxis, yAxis, zAxis,
false -- unknown bool
)
-- Play on Entity
local handle = StartParticleFxLoopedOnEntityBone(
effectName,
entity,
offsetX, offsetY, offsetZ,
rotX, rotY, rotZ,
boneIndex,
scale,
xAxis, yAxis, zAxis
)
-- Stop the effect with handle
StopParticleFxLooped(handle, false)
-- Remove effect immediately (does not fade out)
RemoveParticleFx(handle, false)
VERY IMPORTANT: KEEP THE HANDLE!
Looped effects must hold the handle to stop them:
-- ❌ Wrong — If you don't have a handle, you can't stop!
StartParticleFxLoopedAtCoord("scr_amb_electric_arc", ...)
-- ✅ Correct — keep the handle
local fxHandle = StartParticleFxLoopedAtCoord("scr_amb_electric_arc", ...)
Example: Smoke from a car
local smokeFx = nil
local function StartCarSmoke(vehicle)
RequestNamedPtfxAsset("core")
while not HasNamedPtfxAssetLoaded("core") do
Citizen.Wait(0)
end
local boneIndex = GetEntityBoneIndexByName(vehicle, "exhaust")
UseParticleFxAssetNextCall("core")
smokeFx = StartParticleFxLoopedOnEntityBone(
"ent_veh_engine_smoke",
vehicle,
0.0, 0.0, 0.0, -- offset
0.0, 0.0, 0.0, -- rotation
boneIndex,
1.5, -- scale
false, false, false
)
end
local function StopCarSmoke()
if smokeFx then
StopParticleFxLooped(smokeFx, false)
smokeFx = nil
end
end
Example: Aura Effect on Player
local playerFx = nil
local function StartPlayerAura()
RequestNamedPtfxAsset("scr_powerplay")
while not HasNamedPtfxAssetLoaded("scr_powerplay") do
Citizen.Wait(0)
end
local ped = PlayerPedId()
local boneIndex = GetEntityBoneIndexByName(ped, "SKEL_ROOT")
UseParticleFxAssetNextCall("scr_powerplay")
playerFx = StartParticleFxLoopedOnEntityBone(
"scr_powerplay_overlay_electricity_chars",
ped,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
boneIndex,
1.0,
false, false, false
)
end
AddEventHandler("onResourceStop", function(resourceName)
if resourceName == GetCurrentResourceName() then
if playerFx then
StopParticleFxLooped(playerFx, false)
end
end
end)
Adjust Effect while working
-- Change scale while effect is running.
SetParticleFxLoopedScale(fxHandle, 2.0)
-- Change color (RGBA 0.0-1.0)
SetParticleFxLoopedColour(fxHandle, 1.0, 0.5, 0.0, false)
-- Change evolution parameters
SetParticleFxLoopedEvolution(fxHandle, "speed", 2.0, false)
Popular Effect for Looped
| Effect Name | Dictionary | Description |
|---|---|---|
ent_veh_engine_smoke |
core |
engine smoke |
scr_amb_electric_arc |
scr_rcbarry1 |
Electric spark |
scr_powerplay_overlay_electricity |
scr_powerplay |
aura electric |
ent_amb_cigarette_smoke_p |
core |
Cigarette smoke |
scr_amb_drips_and_sparks |
scr_rcbarry1 |
Sparks |
Summary
Looped Effects require careful lifecycle management — turn them on when needed, turn them off when done, and clean up. always onResourceStop
Related Articles
วิธีจัดการ Version และ Update Script ในเซิร์ฟเวอร์ FiveM อย่างมืออาชีพ
อัพเดท script บน production โดยไม่ให้เซิร์ฟเวอร์ down — เรียนรู้ระบบจัดการ version, Git workflow, และกลยุทธ์ deploy ที่ลดความเสี่ยง
หลักการ Clean Code สำหรับ FiveM Script Developer
โค้ดที่ทำงานได้กับโค้ดที่ดีไม่ใช่สิ่งเดียวกัน — เรียนรู้หลักการ clean code ที่ทำให้ FiveM script ของคุณอ่านง่าย, แก้ง่าย และขยายได้
วิธีทดสอบ FiveM Script ก่อน Deploy ขึ้น Production Server
อย่า deploy script ที่ยังไม่ผ่านการทดสอบลงบน production — เรียนรู้วิธีสร้าง testing workflow สำหรับ FiveM ที่ลด downtime และป้องกัน bug จากผู้เล่นจริง