FiveMLuaParticle FXCustomizationColorScale
Changing Particle Effect Color and Size in FiveM
March 25, 2026
2 min read
5 views
Changing Particle Effect color and size in FiveM
One of the powerful features of PTFX is the ability to customize everything in real-time — color, size, speed, and more.
Scale
Scale of effect set at start:
-- scale = 1.0 is the normal size.
-- scale = 2.0 is 2 times larger than normal.
-- scale = 0.5, which is 2 times smaller than normal.
UseParticleFxAssetNextCall("core")
local handle = StartParticleFxLoopedAtCoord(
"ent_veh_engine_fire",
x, y, z,
0.0, 0.0, 0.0,
3.0, -- scale is very big!
false, false, false, false
)
Change Scale while Looped is running.
-- Change the scale of the looped effect.
SetParticleFxLoopedScale(handle, 2.5)
Color
-- Colors use RGBA values (0.0 - 1.0, not 0-255).
-- R=1.0, G=0.0, B=0.0 = pure red
-- R=0.0, G=1.0, B=0.0 = pure green
SetParticleFxLoopedColour(
handle,
r, g, b, -- 0.0 to 1.0
false -- unknown
)
Examples of various colors
-- Change fire to blue (alien fire!)
SetParticleFxLoopedColour(handle, 0.0, 0.5, 1.0, false)
-- gold color
SetParticleFxLoopedColour(handle, 1.0, 0.85, 0.1, false)
-- purple
SetParticleFxLoopedColour(handle, 0.6, 0.0, 1.0, false)
-- Convert hex color to 0.0-1.0
-- #C9A84C = RGB(201, 168, 76)
SetParticleFxLoopedColour(handle, 201/255, 168/255, 76/255, false)
Evolution Parameters
Evolution parameters are special parameters that each effect has, controlling its behavior in depth:
-- Non-looped
SetParticleFxNonLoopedColour(effectName, r, g, b)
SetParticleFxNonLoopedAlpha(effectName, alpha) -- 0.0-1.0
-- Looped evolution
SetParticleFxLoopedEvolution(
handle,
"evolutionName", -- parameter name
value, -- value
false -- unknown
)
Common Evolution Parameters
-- speed of particles
SetParticleFxLoopedEvolution(handle, "speed", 2.0, false)
-- Density
SetParticleFxLoopedEvolution(handle, "density", 0.5, false)
-- Size of each particle
SetParticleFxLoopedEvolution(handle, "size", 1.5, false)
Example: Dynamic Fire that changes according to vehicle speed.
local fireFx = nil
Citizen.CreateThread(function()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle == 0 then return end
-- start fire effect
RequestNamedPtfxAsset("core")
while not HasNamedPtfxAssetLoaded("core") do
Citizen.Wait(0)
end
UseParticleFxAssetNextCall("core")
fireFx = StartParticleFxLoopedOnEntity(
"ent_veh_engine_fire",
vehicle,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
1.0,
false, false, false
)
-- Loop adjusts scale according to speed.
while fireFx do
local speed = GetEntitySpeed(vehicle)
local scale = math.min(speed / 20.0, 3.0) -- max 3x
SetParticleFxLoopedScale(fireFx, scale)
-- Change color according to speed (slow=yellow, fast=blue)
local t = math.min(speed / 40.0, 1.0)
SetParticleFxLoopedColour(fireFx, 1.0-t, 0.5-t*0.5, t, false)
Citizen.Wait(100)
end
end)
Example: Pulsing Effect
local function PulsingAura(ped)
RequestNamedPtfxAsset("scr_powerplay")
while not HasNamedPtfxAssetLoaded("scr_powerplay") do
Citizen.Wait(0)
end
UseParticleFxAssetNextCall("scr_powerplay")
local handle = StartParticleFxLoopedOnEntityBone(
"scr_powerplay_overlay_electricity_chars",
ped, 0, 0, 0, 0, 0, 0,
GetEntityBoneIndexByName(ped, "SKEL_ROOT"),
1.0, false, false, false
)
-- Pulse animation
local t = 0
Citizen.CreateThread(function()
while handle do
t = t + 0.05
local scale = 1.0 + math.sin(t) * 0.5 -- 0.5 to 1.5
SetParticleFxLoopedScale(handle, scale)
Citizen.Wait(50)
end
end)
return handle
end
Summary
- Scale: Adjust at start or SetParticleFxLoopedScale() later.
- Color: SetParticleFxLoopedColour() with value 0.0-1.0
- Evolution: special parameters of each effect
- Combine with thread loops to create beautiful dynamic effects.
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 จากผู้เล่นจริง