Putting Particle Effect on Ped/Player Bone in FiveM
Putting Particle Effect on Ped/Player Bone
Attaching a Particle Effect to a character's bone causes the effect to track movement — great for auras, weapon trails, or status effects.
What is Bone Index?
Ped in GTA V has a skeleton made up of multiple bones. Each bone has an index that is used as a reference.
-- find bone index from name
local boneIndex = GetEntityBoneIndexByName(entity, boneName)
-- Check that bone exists.
if boneIndex == -1 then
print("Bone not found!")
end
Bone Names that are frequently used
-- body
"SKEL_ROOT" -- center of body (belly)
"SKEL_Pelvis" -- Hips
"SKEL_Spine_Root" -- back tree
"SKEL_Spine3" -- middle back
"SKEL_Head" -- head
"SKEL_Neck_1" -- neck
-- hand
"SKEL_L_Hand" -- left hand
"SKEL_R_Hand" -- Right hand
"SKEL_L_Finger01" -- Left index finger
"SKEL_R_Finger01" -- Right index finger
-- foot
"SKEL_L_Foot" -- left foot
"SKEL_R_Foot" -- right foot
-- Weapons
"IK_R_Hand" -- tip of right hand (used with weapons)
"IK_L_Hand" -- tip of left hand
Example: Aura Effect all around
local auraHandle = nil
local function StartAura(ped)
if not SafeRequestPtfx("scr_powerplay") then return end
local boneIndex = GetEntityBoneIndexByName(ped, "SKEL_ROOT")
UseParticleFxAssetNextCall("scr_powerplay")
auraHandle = StartParticleFxLoopedOnEntityBone(
"scr_powerplay_overlay_electricity_chars",
ped,
0.0, 0.0, 0.0, -- offset (no need to move)
0.0, 0.0, 0.0, -- rotation
boneIndex,
1.5, -- scale
false, false, false
)
end
local function StopAura()
if auraHandle then
StopParticleFxLooped(auraHandle, false)
auraHandle = nil
end
end
Example: Fire flame on hand
local fireFxLeft = nil
local fireFxRight = nil
local function StartHandFire(ped)
if not SafeRequestPtfx("core") then return end
-- left hand
local leftBone = GetEntityBoneIndexByName(ped, "SKEL_L_Hand")
UseParticleFxAssetNextCall("core")
fireFxLeft = StartParticleFxLoopedOnEntityBone(
"ent_anim_fire",
ped,
0.0, 0.0, 0.05, -- offset up a bit.
0.0, 0.0, 0.0,
leftBone,
0.5,
false, false, false
)
-- right hand
local rightBone = GetEntityBoneIndexByName(ped, "SKEL_R_Hand")
UseParticleFxAssetNextCall("core")
fireFxRight = StartParticleFxLoopedOnEntityBone(
"ent_anim_fire",
ped,
0.0, 0.0, 0.05,
0.0, 0.0, 0.0,
rightBone,
0.5,
false, false, false
)
end
Example: Effect on the head (Status Effect)
local function StartHeadEffect(ped, effectName, dictName)
if not SafeRequestPtfx(dictName) then return end
local boneIndex = GetEntityBoneIndexByName(ped, "SKEL_Head")
UseParticleFxAssetNextCall(dictName)
return StartParticleFxLoopedOnEntityBone(
effectName,
ped,
0.0, 0.0, 0.1, -- offset slightly higher from the head.
0.0, 0.0, 0.0,
boneIndex,
0.8,
false, false, false
)
end
-- use
local stunHandle = StartHeadEffect(
PlayerPedId(),
"scr_amb_electric_arc",
"scr_rcbarry1"
)
Example: Non-Looped on Bone
local function BloodSpurtOnBone(ped, boneName)
if not SafeRequestPtfx("core") then return end
local boneIndex = GetEntityBoneIndexByName(ped, boneName)
UseParticleFxAssetNextCall("core")
StartParticleFxNonLoopedOnEntityBone(
"ent_sht_blood",
ped,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
boneIndex,
1.0,
false, false, false
)
end
Tips
- Use offset to adjust the effect position to fit the model.
- SKEL_ROOT suitable for full-body effects
- For weapon effects use IK_R_Hand or IK_L_Hand
- Test boneIndex first to see if != -1 is always
Summary
Bone-attached effects give your script a professional look — try combining bone targeting with looped/non-looped effects to create impressive visual feedback.
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 จากผู้เล่นจริง