Prevent loosing Helmet

Hello i want to prevent loosing my helmet, when i get hit ba a player.

I’ve seen a lot of codes like that:

Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
SetPedCanLosePropsOnDamage(PlayerPedId(), false, 0)
end
end)

or

SetPedCanLosePropsOnDamage(PlayerPedId(), false, 0)

but these scripts gave me this error:

SCRIPT ERROR: @antihatloss/client.lua:1: attempt to call a nil value (global ‘SetPedCanLosePropsOnDamage’)

Do you guys now any way to fix that?
thx

That’s weird, make sure you’re using the latest fx_version and play around with lua54 in your fxmanifest

1 Like

I also think that the fxmanifest is wrong.

client.lua:

Citizen.CreateThread(function()
    while true do
        SetPedCanLosePropsOnDamage(PlayerPedId(), false, 0)
        Citizen.Wait(1000)
    end
end)

fxmanifest.lua

fx_version "cerulean"
game "gta5"
lua54 "yes"

version "1.0.0"

client_scripts { "client.lua" }

works without problems.

1 Like

That’s an entirely different subject, make sure to restart the server first though