Always on headlights not working

Hi! So I’m having problems using the SetVehicleLights native. When I set vehicle lights state to 2, headlights still turn off at daytime. I don’t think I’m doing it wrong, but please tell me if I do. Any information would be appreciated, so thank you for writing in advance.

fx: b12913/Ptero
GameBuild: 3407

local alwaysOn = false
CreateThread(function()
	while true do
		local sleep = 1000
		local ped = PlayerPedId()
		local inCar = IsPedInAnyVehicle(ped)

		if inCar then
			vehicle = GetVehiclePedIsIn(ped, false)
			local _, lightsOn, highlightsOn = GetVehicleLightsState(vehicle)
			if tonumber(lightsOn) + tonumber(highlightsOn) > 0 then
				if not alwaysOn then
					print(lightsOn.." + "..highlightsOn.." = "..lightsOn + highlightsOn)
					print("SetVehicleLights(vehicle, 2)")
					SetVehicleLights(vehicle, 2)
					alwaysOn = true
				end
			else
				if alwaysOn then
					print(lightsOn.." + "..highlightsOn.." = "..lightsOn + highlightsOn)
					print("SetVehicleLights(vehicle, 0)")
					SetVehicleLights(vehicle, 0)
					alwaysOn = false
				end
			end
		end
		Wait(sleep)
	end
end)
1 Like