Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I script a driveby feature?

Asked by 6 years ago
Edited 6 years ago

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

0
You would definitely need to use animations for this and certainly a bit of code, yes. Also, I've never used animations on ROBLOX but I don't think they loop over and over again, unless you make them do so somehow... sodaghost1 34 — 6y
0
I'm sure this is possible. I've added a game example in the post. Joz2015 6 — 6y
0
"I have tried using an animation, but every time I press the button the animation runs through once and then stops." - Have you tried looping the animation? MarceloFBentley 13 — 6y
0
I have. It just starts re-running the "lean out of the window" animation after I press the button. Joz2015 6 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

0
I think this is a good idea. Is there any way to make the static animation exactly like the one when the animation ends, or will I need to manually move it using my best guess as to what it looks like? Joz2015 6 — 6y
0
I'm pretty sure there is a way, sadly I don't know much about animations myself. Perhaps the wiki got the answer on how to do it: http://wiki.roblox.com/index.php?title=Animations . It's all a matter of fully understanding how the animations editor work, I believe. Le_Teapots 913 — 6y
Ad

Answer this question