I’m creating a script and I was able to define when the player wears the armor item, run a progress bar along with animation and after the vest appears, everything works perfect. But I would like to add one more function when the armor goes back to 0 the vest disappears, I am using the native SetPedComponentVariation
This is the function that adds the vest to the player, it works as I said before. I’m new to fivem so I don’t know if it’s the best way to do that
Before anything always try print(“test”) when you’re testing something if it works. As I see in your screenshot you have loop for checking if ped has armor. This might be causing some troubles. Im not perfect in LUA too but you should also try this:
Citizen.CreateThread(function()
while true do
local ped = GetPlayerPed(-1)
local armor = GetPedArmour(ped)
Citizen.Wait(3000)
if armor >= 10 then
TriggerEvent('removevest') -- RegisterNetEvent first
else
return
end
end
end)
Im Not sure it this won’t cause any troubles with native 0x2F7A49E6 but you can try. Also I see you have 6 parameters in Thread instead of 5 so Maybe this is also causing troubles.
And I will add that my solution might not work, but hey! I tried