I'm sorry to hear the speedometer isn't showing up when you get in the car. This usually points to an issue with the inVehicle detection or the NUI communication.
Let's troubleshoot this step-by-step. The most effective way to diagnose NUI issues in FiveM is by checking the F8 console.
Here's what I recommend:
Open the F8 Console in FiveM:
F8 to open the console.fivem-hud). These errors can indicate issues with your script.js or index.html.html/script.js:
We'll add some console.log statements to verify if the UPDATE_HUD messages are being received and if the inVehicle status is correct.Re-download and Replace Files:
script.js with the console.log statements.html/script.js file with the new one.Clear FiveM Cache (Again):
C:\Users\<YourUsername>\AppData\Roaming\CitizenFX\.cef folder and cache.xml.Restart FiveM and Your Server:
Check F8 Console Output:
NUI Message Received, HUD Update Payload, Is in vehicle:, and Speedometer HUD display style: logs.Is in vehicle: true appear?Speedometer HUD display style: flex appear?Please let me know what you see in the F8 console, especially the output of those console.log statements when you are in and out of a vehicle. This will help us pinpoint the exact issue.
Ah, thank you for providing that error!
SCRIPT ERROR: @FiveMHUD/client/main.lua:25: attempt to call a nil value (global 'GetVehicleBatteryLevel')
This error means that the function GetVehicleBatteryLevel is not a standard FiveM native function, or it's not available in your specific server setup. My apologies for including it without confirming its universal availability.
We need to remove that line from client/main.lua. For now, I'll set the battery level to a static 100% in the Lua script, as the JavaScript already handles a default if the value isn't provided. If you have a specific script or framework that provides vehicle battery levels, we can integrate that later.
Here's the updated client/main.lua file:
Please follow these steps to apply the fix:
Replace client/main.lua:
.zip file.client/main.lua file (located in your fivem-hud/client/ folder) with the new one from the download.Clear FiveM Cache (Important!):
C:\Users\<YourUsername>\AppData\Roaming\CitizenFX\.cef folder and cache.xml.After these steps, please check again if the speedometer appears when you get into a car. Also, keep an eye on the F8 console for any new errors or the console.log messages we added previously.