script.Parent:WaitForChild("\065-\067\104\097\115\115\105\115 \073\110\116\101\114\102\097\099\101")script.Parent:WaitForChild("\080\108\117\103\105\110\115")script.Parent:WaitForChild("\082\069\065\068\077\069")local Q=script.Parent.Parent local z=require(script.Parent)local Y=Q.Wheels:GetChildren()for Y,J in pairs(Y)do for Q,z in pairs({"\084\111\112","\066\111\116\116\111\109","\076\101\102\116","\082\105\103\104\116","\070\114\111\110\116","\066\097\099\107"})do J[z.."\083\117\114\102\097\099\101"]=Enum.SurfaceType.SmoothNoOutlines end local H={}local N=J.Position-Q.DriveSeat.Position if J.Name=="\070\076"or J.Name=="\082\076"then J.CFrame=Q.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))else J.CFrame=Q.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))end J.CFrame=J.CFrame+N if J:FindFirstChild("\080\097\114\116\115")~=nil then for Q,z in pairs(J.Parts:GetChildren())do if z:IsA("\066\097\115\101\080\097\114\116")then table.insert(H,{z,J.CFrame:toObjectSpace(z.CFrame)})end end end if J:FindFirstChild("\070\105\120\101\100")~=nil then for Q,z in pairs(J.Fixed:GetChildren())do if z:IsA("\066\097\115\101\080\097\114\116")then table.insert(H,{z;J.CFrame:toObjectSpace(z.CFrame)})end end end if J.Name=="\070\076"or J.Name=="\070\082"then J.CFrame=J.CFrame*CFrame.Angles(math.rad(z.FCamber),0,0)if J.Name=="\070\076"then J.CFrame=J.CFrame*CFrame.Angles(0,math.rad(-z.FCaster),math.rad(z.FToe))else J.CFrame=J.CFrame*CFrame.Angles(0,math.rad(z.FCaster),math.rad(-z.FToe))end else J.CFrame=J.CFrame*CFrame.Angles(math.rad(z.RCamber),0,0)if J.Name=="\082\076"then J.CFrame=J.CFrame*CFrame.Angles(0,math.rad(-z.RCaster),math.rad(z.RToe))else J.CFrame=J.CFrame*CFrame.Angles(0,math.rad(z.RCaster),math.rad(-z.RToe))end end for Q,z in pairs(H)do z[1].CFrame=J.CFrame:toWorldSpace(z[2])end local t=Instance.new("\080\097\114\116",J)t.Name="\065\114\109"t.Anchored=true t.CanCollide=false t.FormFactor=Enum.FormFactor.Custom t.Size=Vector3.new(1,1,1)t.CFrame=(J.CFrame*CFrame.new(0,z.StAxisOffset,0))*CFrame.Angles(-math.pi/2,-math.pi/2,0)t.TopSurface=Enum.SurfaceType.Smooth t.BottomSurface=Enum.SurfaceType.Smooth t.Transparency=1 local h=t:Clone()h.Parent=J h.Name="\066\097\115\101"h.CFrame=h.CFrame*CFrame.new(0,1,0)h.BottomSurface=Enum.SurfaceType.Hinge local n=t:Clone()n.Parent=J n.Name="\065\120\108\101"n.CFrame=CFrame.new(J.Position-(J.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*(J.Size.x/2+n.Size.x/2),J.Position)*CFrame.Angles(0,math.pi,0)n.BackSurface=Enum.SurfaceType.Hinge MakeWeld(Q.DriveSeat,h)if J.Parent.Name=="\082\076"or J.Parent.Name=="\082\082"then MakeWeld(Q.DriveSeat,t)end MakeWeld(t,n)t:MakeJoints()n:MakeJoints()if J:FindFirstChild("\070\105\120\101\100")~=nil then ModelWeld(J.Fixed,n)end if J:FindFirstChild("\080\097\114\116\115")~=nil then ModelWeld(J.Parts,J)end if J:FindFirstChild("\083\116\101\101\114")then(J:FindFirstChild("\083\116\101\101\114")):Destroy()end local r=Instance.new("\066\111\100\121\071\121\114\111",J)r.Name="\083\116\097\098\105\108\105\122\101\114"if J.Name=="\070\076"or J.Name=="\070\082"then r.D=z.FGyroD r.MaxTorque=z.FGyroMaxTorque r.P=z.FGyroP else r.D=z.RGyroD r.MaxTorque=z.RGyroMaxTorque r.P=z.RGyroP end if J.Name=="\070\076"or J.Name=="\070\082"then local Q=Instance.new("\066\111\100\121\071\121\114\111",t)Q.Name="\083\116\101\101\114"Q.P=z.SteerP Q.D=z.SteerD Q.MaxTorque=Vector3.new(0,z.SteerMaxTorque,0)Q.cframe=h.CFrame else MakeWeld(h,n,"\087\101\108\100")end local K=Instance.new("\066\111\100\121\065\110\103\117\108\097\114\086\101\108\111\099\105\116\121",J)K.Name="\035\065\086"K.angularvelocity=Vector3.new(0,0,0)K.maxTorque=Vector3.new(z.PBrakeForce,0,z.PBrakeForce)K.P=1000000000.0 end for Q,z in pairs(script:GetChildren())do if z:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then require(z)end end wait()ModelWeld(Q.Body,Q.DriveSeat)local J=Instance.new("\066\111\100\121\071\121\114\111",Q.DriveSeat)J.Name="\070\108\105\112"J.D=0 J.MaxTorque=Vector3.new(0,0,0)J.P=0 wait()UnAnchor(Q)script.Parent["\065-\067\104\097\115\115\105\115 \073\110\116\101\114\102\097\099\101"].Car.Value=Q for z,Y in pairs(script.Parent.Plugins:GetChildren())do for z,J in pairs(Y:GetChildren())do if J:IsA("\082\101\109\111\116\101\069\118\101\110\116")or Y:IsA("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")then J.Parent=Q for Q,z in pairs(J:GetChildren())do if z:IsA("\083\099\114\105\112\116")then z.Disabled=false end end end end Y.Parent=script.Parent["\065-\067\104\097\115\115\105\115 \073\110\116\101\114\102\097\099\101"]end script.Parent.Plugins:Destroy()Q.DriveSeat.ChildAdded:connect(function(z)if z.Name=="\083\101\097\116\087\101\108\100"and(z:IsA("\087\101\108\100")and game.Players:GetPlayerFromCharacter(z.Part1.Parent)~=nil)then local Y=game.Players:GetPlayerFromCharacter(z.Part1.Parent)Q.DriveSeat:SetNetworkOwner(Y)local J=script.Parent["\065-\067\104\097\115\115\105\115 \073\110\116\101\114\102\097\099\101"]:Clone()J.Parent=Y.PlayerGui end end)Q.DriveSeat.ChildRemoved:connect(function(z)if z.Name=="\083\101\097\116\087\101\108\100"and z:IsA("\087\101\108\100")then for Q,z in pairs(Q.DriveSeat:GetChildren())do if z:IsA("\083\111\117\110\100")then z:Stop()end end if Q.DriveSeat:FindFirstChild("\070\108\105\112")~=nil then Q.DriveSeat.Flip.MaxTorque=Vector3.new()end for Q,z in pairs(Q.Wheels:GetChildren())do if z:FindFirstChild("\035\065\086")~=nil then if z["\035\065\086"].AngularVelocity.Magnitude>0 then z["\035\065\086"].AngularVelocity=Vector3.new()z["\035\065\086"].MaxTorque=Vector3.new()end end end end end)ver=require(script.Parent.README)
--
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")

local car = script.Parent.Parent
local _Tune = require(script.Parent)

local Drive = car.Wheels:GetChildren()

for _, v in pairs(Drive) do
	for _, a in pairs({ "Top", "Bottom", "Left", "Right", "Front", "Back" }) do
		v[a .. "Surface"] = Enum.SurfaceType.SmoothNoOutlines
	end

	local WParts = {}

	local tPos = v.Position - car.DriveSeat.Position
	if v.Name == "FL" or v.Name == "RL" then
		v.CFrame = car.DriveSeat.CFrame * CFrame.Angles(math.rad(90), 0, math.rad(90))
	else
		v.CFrame = car.DriveSeat.CFrame * CFrame.Angles(math.rad(90), 0, math.rad(-90))
	end
	v.CFrame = v.CFrame + tPos

	if v:FindFirstChild("Parts") ~= nil then
		for _, a in pairs(v.Parts:GetChildren()) do
			if a:IsA("BasePart") then
				table.insert(WParts, { a, v.CFrame:toObjectSpace(a.CFrame) })
			end
		end
	end
	if v:FindFirstChild("Fixed") ~= nil then
		for _, a in pairs(v.Fixed:GetChildren()) do
			if a:IsA("BasePart") then
				table.insert(WParts, { a, v.CFrame:toObjectSpace(a.CFrame) })
			end
		end
	end
	if v.Name == "FL" or v.Name == "FR" then
		v.CFrame = v.CFrame * CFrame.Angles(math.rad(_Tune.FCamber), 0, 0)
		if v.Name == "FL" then
			v.CFrame = v.CFrame * CFrame.Angles(0, math.rad(-_Tune.FCaster), math.rad(_Tune.FToe))
		else
			v.CFrame = v.CFrame * CFrame.Angles(0, math.rad(_Tune.FCaster), math.rad(-_Tune.FToe))
		end
	else
		v.CFrame = v.CFrame * CFrame.Angles(math.rad(_Tune.RCamber), 0, 0)
		if v.Name == "RL" then
			v.CFrame = v.CFrame * CFrame.Angles(0, math.rad(-_Tune.RCaster), math.rad(_Tune.RToe))
		else
			v.CFrame = v.CFrame * CFrame.Angles(0, math.rad(_Tune.RCaster), math.rad(-_Tune.RToe))
		end
	end

	for _, a in pairs(WParts) do
		a[1].CFrame = v.CFrame:toWorldSpace(a[2])
	end

	local arm = Instance.new("Part", v)
	arm.Name = "Arm"
	arm.Anchored = true
	arm.CanCollide = false
	arm.FormFactor = Enum.FormFactor.Custom
	arm.Size = Vector3.new(1, 1, 1)
	arm.CFrame = (v.CFrame * CFrame.new(0, _Tune.StAxisOffset, 0)) * CFrame.Angles(-math.pi / 2, -math.pi / 2, 0)
	arm.TopSurface = Enum.SurfaceType.Smooth
	arm.BottomSurface = Enum.SurfaceType.Smooth
	arm.Transparency = 1

	local base = arm:Clone()
	base.Parent = v
	base.Name = "Base"
	base.CFrame = base.CFrame * CFrame.new(0, 1, 0)
	base.BottomSurface = Enum.SurfaceType.Hinge

	local axle = arm:Clone()
	axle.Parent = v
	axle.Name = "Axle"
	axle.CFrame = CFrame.new(
		v.Position - ((v.CFrame * CFrame.Angles(math.pi / 2, 0, 0)).lookVector * ((v.Size.x / 2) + (axle.Size.x / 2))),
		v.Position
	) * CFrame.Angles(0, math.pi, 0)
	axle.BackSurface = Enum.SurfaceType.Hinge
	MakeWeld(car.DriveSeat, base)
	if v.Parent.Name == "RL" or v.Parent.Name == "RR" then
		MakeWeld(car.DriveSeat, arm)
	end

	MakeWeld(arm, axle)

	arm:MakeJoints()
	axle:MakeJoints()

	if v:FindFirstChild("Fixed") ~= nil then
		ModelWeld(v.Fixed, axle)
	end

	if v:FindFirstChild("Parts") ~= nil then
		ModelWeld(v.Parts, v)
	end

	if v:FindFirstChild("Steer") then
		v:FindFirstChild("Steer"):Destroy()
	end

	local gyro = Instance.new("BodyGyro", v)
	gyro.Name = "Stabilizer"
	if v.Name == "FL" or v.Name == "FR" then
		gyro.D = _Tune.FGyroD
		gyro.MaxTorque = _Tune.FGyroMaxTorque
		gyro.P = _Tune.FGyroP
	else
		gyro.D = _Tune.RGyroD
		gyro.MaxTorque = _Tune.RGyroMaxTorque
		gyro.P = _Tune.RGyroP
	end

	if v.Name == "FL" or v.Name == "FR" then
		local steer = Instance.new("BodyGyro", arm)
		steer.Name = "Steer"
		steer.P = _Tune.SteerP
		steer.D = _Tune.SteerD
		steer.MaxTorque = Vector3.new(0, _Tune.SteerMaxTorque, 0)
		steer.cframe = base.CFrame
	else
		MakeWeld(base, axle, "Weld")
	end

	local AV = Instance.new("BodyAngularVelocity", v)
	AV.Name = "#AV"
	AV.angularvelocity = Vector3.new(0, 0, 0)
	AV.maxTorque = Vector3.new(_Tune.PBrakeForce, 0, _Tune.PBrakeForce)
	AV.P = 1e9
end

for i, v in pairs(script:GetChildren()) do
	if v:IsA("ModuleScript") then
		require(v)
	end
end

wait()
ModelWeld(car.Body, car.DriveSeat)

local flipG = Instance.new("BodyGyro", car.DriveSeat)
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0, 0, 0)
flipG.P = 0

wait()

UnAnchor(car)

script.Parent["A-Chassis Interface"].Car.Value = car
for i, v in pairs(script.Parent.Plugins:GetChildren()) do
	for _, a in pairs(v:GetChildren()) do
		if a:IsA("RemoteEvent") or v:IsA("RemoteFunction") then
			a.Parent = car
			for _, b in pairs(a:GetChildren()) do
				if b:IsA("Script") then
					b.Disabled = false
				end
			end
		end
	end
	v.Parent = script.Parent["A-Chassis Interface"]
end
script.Parent.Plugins:Destroy()

car.DriveSeat.ChildAdded:connect(function(child)
	if
		child.Name == "SeatWeld"
		and child:IsA("Weld")
		and game.Players:GetPlayerFromCharacter(child.Part1.Parent) ~= nil
	then
		local p = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
		car.DriveSeat:SetNetworkOwner(p)
		local g = script.Parent["A-Chassis Interface"]:Clone()
		g.Parent = p.PlayerGui
	end
end)
car.DriveSeat.ChildRemoved:connect(function(child)
	if child.Name == "SeatWeld" and child:IsA("Weld") then
		for i, v in pairs(car.DriveSeat:GetChildren()) do
			if v:IsA("Sound") then
				v:Stop()
			end
		end
		if car.DriveSeat:FindFirstChild("Flip") ~= nil then
			car.DriveSeat.Flip.MaxTorque = Vector3.new()
		end
		for i, v in pairs(car.Wheels:GetChildren()) do
			if v:FindFirstChild("#AV") ~= nil then
				if v["#AV"].AngularVelocity.Magnitude > 0 then
					v["#AV"].AngularVelocity = Vector3.new()
					v["#AV"].MaxTorque = Vector3.new()
				end
			end
		end
	end
end)

ver = require(script.Parent.README)
