Fandom

ROBLOX Wikia

VehicleSeats

12,580pages on
this wiki
Add New Page
Comments0 Share

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:

while true do
end

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:

while true do
wait(0.01)
end

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:

local Axis = script.Parent
local Speed = script.Parent.Speed.Value
while true do
wait()
if script.Parent.Steer == 1 then
Axis.Reflectance = 0 --Make the seat not shiny
end
if script.Parent.Steer == -1 then
Axis.Reflectance = 0.5 --Make the seat pretty shiny
end
if script.Parent.Steer == 0 then
Axis.Reflectance = 1 --Make the seat very shiny
end
if script.Parent.Throttle == 1 then
Axis.Transparency = 0.75 --Make the more transparent 
end
if script.Parent.Throttle == -1 then
Axis.Transparency = 0 --Make the seat opaue
end
if script.Parent.Throttle == 0 then
Axis.Transparency = 0.5 -- Make the seat see-through
end
end

Now, hop on your seat and begin to drive with the arrow keys, and watch what happens to the seat!

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.