Chassis={}Chassis.root=PackagedVehicle:FindFirstChild("\067\104\097\115\115\105\115")Chassis.Body=PackagedVehicle:FindFirstChild("\066\111\100\121")Chassis.driverSeat=Chassis.root:FindFirstChildOfClass("\086\101\104\105\099\108\101\083\101\097\116")Chassis.passengerSeats={Chassis.root:FindFirstChild("\083\101\097\116\070\082");Chassis.root:FindFirstChild("\083\101\097\116\082\076");Chassis.root:FindFirstChild("\083\101\097\116\082\082")}local Y=Chassis.root:FindFirstChild("\083\117\115\112\101\110\115\105\111\110\070\076")local u=Y.Wheel.Size.y/2 Chassis.driverSeat.MaxSpeed=VehicleParameters.MaxSpeed*u function Chassis.InitializeDrivingValues()Motors=getVehicleMotors()local Y=getSprings("\083\116\114\117\116\070\114\111\110\116")local u=getSprings("\083\116\114\117\116\082\101\097\114")local d=getSprings("\084\111\114\115\105\111\110\066\097\114")RedressMount=Chassis.root:WaitForChild("\082\101\100\114\101\115\115\077\111\117\110\116")SteeringPrismatic=constraints:FindFirstChild("\083\116\101\101\114\105\110\103\080\114\105\115\109\097\116\105\099")SteeringPrismatic.UpperLimit=VehicleParameters.MaxSteer SteeringPrismatic.LowerLimit=-VehicleParameters.MaxSteer for Y,u in pairs(Y)do adjustSpring(u,ActualStrutSpringStiffnessFront,ActualStrutSpringDampingFront)end for Y,u in pairs(u)do adjustSpring(u,ActualStrutSpringStiffnessRear,ActualStrutSpringDampingRear)end for Y,u in pairs(d)do adjustSpring(u,ActualTorsionSpringStiffness,ActualTorsionSpringDamping)end local R=Chassis.root:GetChildren()for Y=1,#R,1 do local u=R[Y]if u:IsA("\077\111\100\101\108")then local Y=u:FindFirstChild("\087\104\101\101\108")if Y then local u=Y.CustomPhysicalProperties local d=PhysicalProperties.new(u.Density,VehicleParameters.WheelFriction,u.Elasticity,u.FrictionWeight,u.ElasticityWeight)Y.CustomPhysicalProperties=d end end end setMotorTorque(10000)end function Chassis.GetDriverSeat()return Chassis.driverSeat end function Chassis.GetPassengerSeats()return Chassis.passengerSeats end function Chassis.GetBase()return Chassis.root.PrimaryPart or Chassis.root:FindFirstChild("\070\108\111\111\114\080\097\110\101\108")end
--
Chassis = {}

Chassis.root = PackagedVehicle:FindFirstChild("Chassis") --the root of the Chassis model
Chassis.Body = PackagedVehicle:FindFirstChild("Body") -- the body of the Chassis model
Chassis.driverSeat = Chassis.root:FindFirstChildOfClass("VehicleSeat")
Chassis.passengerSeats = {
		Chassis.root:FindFirstChild("SeatFR"),
		Chassis.root:FindFirstChild("SeatRL"),
		Chassis.root:FindFirstChild("SeatRR")
}

local randomSuspension = Chassis.root:FindFirstChild("SuspensionFL")
local wheelRadius = randomSuspension.Wheel.Size.y/2
Chassis.driverSeat.MaxSpeed = VehicleParameters.MaxSpeed * wheelRadius

function Chassis.InitializeDrivingValues()
	-- Constraint tables always ordered FL, FR, RL, RR
	Motors = getVehicleMotors()
	
	local strutSpringsFront = getSprings("StrutFront")
	local strutSpringsRear = getSprings("StrutRear")
	local torsionSprings = getSprings("TorsionBar")

	RedressMount = Chassis.root:WaitForChild("RedressMount")
	
	SteeringPrismatic = constraints:FindFirstChild("SteeringPrismatic")
	SteeringPrismatic.UpperLimit = VehicleParameters.MaxSteer
	SteeringPrismatic.LowerLimit = -VehicleParameters.MaxSteer

	for _,s in pairs(strutSpringsFront) do
		adjustSpring(s, ActualStrutSpringStiffnessFront, ActualStrutSpringDampingFront)
	end
	for _,s in pairs(strutSpringsRear) do
		adjustSpring(s, ActualStrutSpringStiffnessRear, ActualStrutSpringDampingRear)
	end
	for _,s in pairs(torsionSprings) do
		adjustSpring(s, ActualTorsionSpringStiffness, ActualTorsionSpringDamping)
	end
	
	local chassisChildren = Chassis.root:GetChildren()
	for i = 1, #chassisChildren do
		local model = chassisChildren[i]
		if model:IsA("Model") then
			local wheel = model:FindFirstChild("Wheel")
			if wheel then
				local old = wheel.CustomPhysicalProperties
				local new = PhysicalProperties.new(old.Density, VehicleParameters.WheelFriction, old.Elasticity, old.FrictionWeight, old.ElasticityWeight)
				wheel.CustomPhysicalProperties = new
			end
		end
	end

	setMotorTorque(10000)
end

function Chassis.GetDriverSeat()
	return Chassis.driverSeat
end

function Chassis.GetPassengerSeats()
	return Chassis.passengerSeats
end

function Chassis.GetBase()
	return Chassis.root.PrimaryPart or Chassis.root:FindFirstChild("FloorPanel")
end
