while(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Heartbeat:wait()and(car:FindFirstChild("\068\114\105\118\101\083\101\097\116")and character.Humanoid.SeatPart==car.DriveSeat)do if IsGrounded()then if movement.Y~=0 then local A=(humanoidRootPart.CFrame.lookVector*movement.Y)*stats.Speed.Value humanoidRootPart.Velocity=humanoidRootPart.Velocity:Lerp(A,.1)bodyVelocity.maxForce=Vector3.new(0,0,0)else bodyVelocity.maxForce=Vector3.new(mass/2,mass/4,mass/2)end local A=humanoidRootPart.CFrame:vectorToWorldSpace(Vector3.new((movement.Y*stats.Speed.Value)/50,0,(-humanoidRootPart.RotVelocity.Y*5)*movement.Y))local r=-(humanoidRootPart.CFrame:vectorToObjectSpace(humanoidRootPart.Velocity)).unit.Z rotation=rotation+math.rad((-stats.Speed.Value/5)*movement.Y)if math.abs(r)>.1 then A=A+humanoidRootPart.CFrame:vectorToWorldSpace(Vector3.new(0,(-movement.X*r)*stats.TurnSpeed.Value,0))bodyAngularVelocity.maxTorque=Vector3.new(0,0,0)else bodyAngularVelocity.maxTorque=Vector3.new(mass/4,mass/2,mass/4)end humanoidRootPart.RotVelocity=humanoidRootPart.RotVelocity:Lerp(A,.1)else bodyVelocity.maxForce=Vector3.new(0,0,0)bodyAngularVelocity.maxTorque=Vector3.new(0,0,0)end for A,r in pairs(car:GetChildren())do if r.Name=="\084\104\114\117\115\116\101\114"then UpdateThruster(r)end end end for A,r in pairs(car:GetChildren())do if r:FindFirstChild("\066\111\100\121\084\104\114\117\115\116")then r.BodyThrust:Destroy()end end bodyVelocity:Destroy()bodyAngularVelocity:Destroy()script:Destroy()
--spawn(function()
while
	game:GetService("RunService").Heartbeat:wait()
	and car:FindFirstChild("DriveSeat")
	and character.Humanoid.SeatPart == car.DriveSeat
do
	--game:GetService("RunService").RenderStepped:wait()
	if IsGrounded() then
		if movement.Y ~= 0 then
			local velocity = humanoidRootPart.CFrame.lookVector * movement.Y * stats.Speed.Value
			humanoidRootPart.Velocity = humanoidRootPart.Velocity:Lerp(velocity, 0.1)
			bodyVelocity.maxForce = Vector3.new(0, 0, 0)
		else
			bodyVelocity.maxForce = Vector3.new(mass / 2, mass / 4, mass / 2)
		end
		local rotVelocity = humanoidRootPart.CFrame:vectorToWorldSpace(
			Vector3.new(movement.Y * stats.Speed.Value / 50, 0, -humanoidRootPart.RotVelocity.Y * 5 * movement.Y)
		)
		local speed = -humanoidRootPart.CFrame:vectorToObjectSpace(humanoidRootPart.Velocity).unit.Z
		rotation = rotation + math.rad((-stats.Speed.Value / 5) * movement.Y)
		if math.abs(speed) > 0.1 then
			rotVelocity = rotVelocity
				+ humanoidRootPart.CFrame:vectorToWorldSpace(
					(Vector3.new(0, -movement.X * speed * stats.TurnSpeed.Value, 0))
				)
			bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
		else
			bodyAngularVelocity.maxTorque = Vector3.new(mass / 4, mass / 2, mass / 4)
		end
		humanoidRootPart.RotVelocity = humanoidRootPart.RotVelocity:Lerp(rotVelocity, 0.1)

		--bodyVelocity.maxForce = Vector3.new(mass / 3, mass / 6, mass / 3)
		--bodyAngularVelocity.maxTorque = Vector3.new(mass / 6, mass / 3, mass / 6)
	else
		bodyVelocity.maxForce = Vector3.new(0, 0, 0)
		bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
	end

	for i, part in pairs(car:GetChildren()) do
		if part.Name == "Thruster" then
			UpdateThruster(part)
		end
	end
end
for i, v in pairs(car:GetChildren()) do
	if v:FindFirstChild("BodyThrust") then
		v.BodyThrust:Destroy()
	end
end
bodyVelocity:Destroy()
bodyAngularVelocity:Destroy()
--camera.CameraType = oldCameraType
script:Destroy()
