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 b=Chassis.root:FindFirstChild("\083\117\115\112\101\110\115\105\111\110\070\076")local Q=b.Wheel.Size.y/2 Chassis.driverSeat.MaxSpeed=VehicleParameters.MaxSpeed*Q function Chassis.InitializeDrivingValues()Motors=getVehicleMotors()local b=getSprings("\083\116\114\117\116\070\114\111\110\116")local Q=getSprings("\083\116\114\117\116\082\101\097\114")local O=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 b,Q in pairs(b)do adjustSpring(Q,ActualStrutSpringStiffnessFront,ActualStrutSpringDampingFront)end for b,Q in pairs(Q)do adjustSpring(Q,ActualStrutSpringStiffnessRear,ActualStrutSpringDampingRear)end for b,Q in pairs(O)do adjustSpring(Q,ActualTorsionSpringStiffness,ActualTorsionSpringDamping)end local o=Chassis.root:GetChildren()for b=1,#o,1 do local Q=o[b]if Q:IsA("\077\111\100\101\108")then local b=Q:FindFirstChild("\087\104\101\101\108")if b then local Q=b.CustomPhysicalProperties local O=PhysicalProperties.new(Q.Density,VehicleParameters.WheelFriction,Q.Elasticity,Q.FrictionWeight,Q.ElasticityWeight)b.CustomPhysicalProperties=O 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
--[[ Module Functions ]]
--
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
