Disable the bike helmet

Any reason why when i do the following, it sort of constantly does the animation of putting the helmet on and off? would there be anyway to stop it from doing this?

*Citizen.CreateThread( function()*

*    while true do*

*        Citizen.Wait(100)        *

*        local playerPed = GetPlayerPed(-1)*
*        local playerVeh = GetVehiclePedIsUsing(playerPed)*
*        if gPlayerVeh ~= 0 then RemovePedHelmet(playerPed,true) end*
*    end*
*end)*