Proper way to make vehicles?

So I want to add vehicles to my game some time, just not an objective right now, but I’d like to know what the proper way is to make vehicles that Players and NPC’s can both interact with equal right’s/abilities.

Like both being able to drive the vehicle no matter what; helicopter, tank, ship etc.

I could just add a vehicles folder to my Map folder or somewhere else and give it a data folder/config with the type of vehicle and a module assigned to the type of vehicle and also Health and Armor.

I just wanna hear what you all think

1 Like

Hey, @CybeCC,

This is what I would do in this case:

  1. Create a class for each kind of vehicle in your game using a ModuleScript and place it in ReplicatedStorage so both client and server can access it.

  2. Add a Configuration object inside your vehicle model with values representing properties for this vehicle as you said, so vehicles of the same kind can have different properties, such as the speed.

  3. Add a Tag for each vehicle in your game along with Collection Service in a script to require the ModuleScript class created in the first step, or simply just create a vehicles folder inside Workspace, as you also mentioned.

*I think it would be interesting to implement the vehicles module using OOP (Object-Oriented Programming)

*For the NPCs, I’m not sure, but i do think you have to create some kind of logic or verification to see if it’s a real player or not.

2 Likes

The Tags for the Team which is it a part of or if its a vehicle? I have a “Placements” folder inside my game, which works, but is for things like turrets, walls etc.