Vehicle Weapon Controls Help

Hello developers,

I am trying to create a vehicle system where players are able to drive vehicles around text that have weapons built in.

I wanted the weapons to function similar to how the game “Armored Patrol” does it.

The user is able to both drive the vehicle as well as control a variety of weapons depending on what’s available on the vehicle. I noticed while playing that the player uses a tool in their backpack to control the vehicle. I’m not sure if this is necessary to achieve the same affect the game has.

I already have a system for driving vehicles I am just unsure on how to take input from the player that is inside a vehicle seat in order to control a weapon attached to the vehicle.

I have not really tried anything yet related to this as I’m not really sure what direction to go in as I haven’t seen much information on a topic like this. If anybody could provide any direction for this problem I would really appreciate it.

You could use ContextActionService to make binds or you could use UserInputService and check if the player is in the vehicle.

I was thinking about doing something like that but where should I have a localscript for this. Should I put it in starter character or player scripts?

I would do starter player scripts personally

Now what if I wanted to make the weapon like a tank barrel or a machine gun actively point to the players mouse position. I should just continuously fire a remote event or is there a more performant solution?

Well, you could either only update the rotation on the client and fire the remote only when the player fires/stops. Another thing you could do is use an unreliable remote event connected to a runservice loop.

I could make a RE for firing the weapon and an URE for updating the position.

I’m going to play around with this idea thank you for your help.

Yeah thats a great idea. You’re welcome!