I am by no means asking for a full script or incredibly specific code.
How would I script drive-by functionality for when you press a button while sitting in a car?
I understand how to check if the player is sitting down in a car, but I'm not sure on how to make the character bend over and lean out of the car.
Would I use an animation? Weld the torso? How would I change the position of the arms without killing the player?
I have tried using an animation, but every time I press the button the animation runs through once and then stops.
I want you to stick your head out the window as long as said button is held down.
Just some general steps would be appreciated.
This functionality is present in Moon City: https://www.roblox.com/games/679737281/link
I believe what you would need is to have an Animation play when your desired key gets pressed (the one making your character lean out of the car), and then follow it up by replacing your default "idle" character animation for a custom one (an static one of your character sticking its head out the window). Finally, have your script detect when the key gets released to restore the default roblox idle animation.
Hopes this answers your question.