I have an "Online Car Dealership" pretty much you are able to buy cars on a GUI in StarterGui and I want to have the player have only one car spawned at a time, so if he spawns in a new car, his old car will be deleted/destroyed.
I don't have any code because I am stumped on how to attempt this.
it is very simple. just like tools, when it is equipped, it put weapon on your hands, when you select another tool, the previous tool is gone, the new tool shown up. of course, you need to do destroy() in unequip event.
so now, back to your car. each car is a tool in your backpack, except, when you equip one tool, instead of weld a weapon into your hand. you spawn a car right in front of your torso position.
now,dont forget to implement unequip event, you need to destroy the car. before, another equip event is called.
so no matter you press 1, 2 3, 4, 5, or use mouse buttons, you only have one car in front of you