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

Is there any way to make a plane script without needing a tool? [Solved]

Asked by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago

I'm not asking you to script a plane for me, I'm just wondering how it is done without requiring a tool in the process. My initial theory was that the script to control the plane would be in the seat of the plane itself and that when the seat's occupant was changed, it would inject a local script into the player character that would hold all the keyboard input and that the plane would only accept input from that player, but it didn't seem to work and probably is too complicated.

I've also remembered vaguely from attempts I've made years ago that there is an onSit function, but I haven't been able to find my old notes or any new information on this.

Just a reminder that I'm not asking you to come up with a whole script, but if you can add at least some pseudocode to help explain your answer, it would be appreciated.

0
You can use Roblox's BodyGyro and BodyVelocity forces to do this. The Seat object can help for it's events/functions. You should get to know how they work before attempting this. xPolarium 1388 — 5y
0
Is there any place where I can learn about each objects events and functions? I can't seem to find any good source of info on that. Also I'm planning on having the workspace gravity be 0, so I won't have to deal with gravity, and I do understand how to move the actual plane with bodyGyro and bodyVelocity forces, but what I'm having difficulty with is how to know which player is controlling the pla SteamG00B 1633 — 5y
0
Use developer.roblox.com to see documentation and tutorials. The Seat object has the Touched event and an Occupant property to see which player is sitting on it. xPolarium 1388 — 5y
0
Oh wait I knew it had a Touched event, I just thought that it wouldn't work because I was thinking that if it was touched by another part, it would mess things up, but I didn't even realize that I could combine the Occupant property with the Touched event to check if a player sat in it. SteamG00B 1633 — 5y
0
You don't need to combine the two. They're both examples for your question. The touched property has a hit parameter. You would check if 'hit.Parent' is a player by seeing if it has a 'Humanoid' as one of it's children. xPolarium 1388 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago

My solution was to have the plane control script inside the player and then have the script become enabled when a player sat in a vehicle's seat and disabled when the player got out.

Ad

Answer this question