abstract
| - VehicleSeats are ROBLOX's "car seats ". They can be used to make cars and other such vehicles. They were made in early 2009 by the ROBLOX team and served as a replacement for hopper bin controlled cars. The main use for these seats is to simply make cars, but they can be scripted for other things and uses, they also include some different properties. The properties of a VehicleSeat are a little different from the ROBLOX part, and these are the following:
* MaxSpeed - Set this to any number of speed for your car to drive at.
* Torque - How much power the car has, make higher for big cars and lower for small cars.
* Throttle - Tells which way a car is going while a player is driving, 1 for forward and -1 for backwards
* Steer - Tells which way a car is turning, pretty much the same as the throttle except in the turning aspect.
* TurnSpeed - Although it appears to control the speed of the car turning, it doesn't appear to have much effect. Now that we know the special properties of a VehicleSeat, let's add a script to make things happen when you drive your vehicle(scripts will be in bold). Now, create a script and place it into a VehicleSeat . The first thing we want is to detect constantly what is happening to the special properties of a VehicleSeat and make the script do something once one of them is a certain value. To make a constant script, that runs endlessly, we're going to start it with a loop. To start an endless loop, type the following into your script. Don't forget to add the keyword "end" to your loop or else it won't work: Now, since we don't want this loop to repeat faster than possible and crash the game, we add a "wait". The wait can be used to delay the script for a certain amount of time. Once you add a wait to a loop, it will run every time the wait ends. To add a wait, simply type wait() above what you wish to delay, what goes in the ()'s is the number of seconds you wish to be delayed. The script should now look like this: Now let's start with the IF's. The "if" can be used to determine if something is equal to, is greater than, less than, and not equal to. These IF's will finish up the script. Also, inside the IF's is where we tell the seat to move and do stuff. Now, we're going to include "locals". Declaring something as a local makes it much easier to type and shortens up and makes scripts much easier to use. Here's what it should look like once we add these: Now, hop on your seat and begin to drive with the arrow keys, and watch what happens to the seat!
|