Switching characters in QBCore and running into an issue where weapon attachments from the previous character are sticking around on the new one. The database has the right attachment data for each character, but something's getting cached somewhere.
When I switch chars, the client-side inventory shows attachments that belonged to the old character, and the shooting behavior reflects those wrong attachments too. Other players see the correct attachments though, so it's definitely client-side state persistence.
Looking at the logs, I can see weaponComponentAdd events firing with component names from the previous character. The statebag seems to be holding onto old weapon metadata even after the character unload. My character switch system uses the standard PlayerData reset flow, but there's no cleanup happening for weapon attachment states.
RegisterNetEvent('QBCore:Client:OnPlayerUnload') AddEventHandler('QBCore:Client:OnPlayerUnload', function()
-- Missing weapon metadata cleanup
TriggerServerEvent('qb-inventory:server:SaveInventory')
end)
-- Character load doesn't clear weapon states properly
RegisterNetEvent('QBCore:Client:OnPlayerLoaded') AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
-- Weapon attachments may still reference old character data
QBCore.Functions.GetPlayerData(function(PlayerData)
-- No weapon metadata validation occurs here
end)
end)Anyone dealt with this before? Sounds like I need some weapon state cleanup during character unload, but not sure what the proper approach is for qb-inventory's weapon handling.
MrNugget · 30/08/2026
Sign in to reply.