This is a simple script that adds bikes as an item, that when used places them into the world. The player can then ride the bike like normal and when done pick the bike back up and receive the item.
When picking up a bike, all of the metadata (primaryColor, secondaryColor, pearlescentColor, wheelColor, xenonColor) is saved to the item so that it can be placed back into the world with the same state it was in when picked up.
Dependencies
QBCore / ESX / Or other frameworks (must implement framework specific solutions in framework.lua)
Performance
This script is very lightweight and has no impact on performance.
Do you know if ESX has a way to store metadata/ item info on items?
Anyways, looks like I need to add some additional checks that the info exists first. So for scripts that do not have item metadata support, that just means that the bike metadata (like colors) will not persist.