← Back to Racing Scripts

Car Controller Script

Customize your variables, then fill in the blanks!

Your Custom Settings

How sharp the car can turn

Script (inside VehicleSeat)

This script controls the car's wheels and steering. Name your wheel hinge constraints: LeftWheel, LeftWheel2, RightWheel, RightWheel2, and Steer.

local leftWheel = script..Parent.LeftWheel
local leftWheel2 = script.Parent.Parent.LeftWheel2
local rightWheel = script.Parent.Parent.RightWheel
local rightWheel2 = script.Parent.Parent.RightWheel2
local steer = script.Parent.Parent.Steer
local speed = 25
script.Parent.:Connect(function(property)
    leftWheel. = speed * script.Parent.
    leftWheel2.AngularVelocity = speed * script.Parent.Throttle
    rightWheel.AngularVelocity = speed * -script.Parent.Throttle
    rightWheel2.AngularVelocity = speed * -script.Parent.Throttle
    steer. = 30 * script.Parent.
end)