local F=0 function getMass(u)for u,A in pairs(u:GetChildren())do if A:IsA("\066\097\115\101\080\097\114\116")then F=F+A:GetMass()end getMass(A)end end getMass(car)if F<_Tune.Weight*weightScaling then local u=Vector3.new()local A=Vector3.new()local l=0 local I=0 for F,H in pairs(Drive)do if H.Name=="\070\076"or H.Name=="\070\082"or H.Name=="\070"then u=u+H.CFrame.p l=l+1 else A=A+H.CFrame.p I=I+1 end end u=u/l A=A/I local H=A:Lerp(u,_Tune.WeightDist/100)local i=Instance.new("\080\097\114\116",car.Body)i.Name="\035\087\101\105\103\104\116"i.Anchored=true i.CanCollide=false i.BrickColor=BrickColor.new("\082\101\097\108\108\121 \098\108\097\099\107")i.TopSurface=Enum.SurfaceType.Smooth i.BottomSurface=Enum.SurfaceType.Smooth if _Tune.WBVisible then i.Transparency=.75 else i.Transparency=1 end i.Size=Vector3.new(_Tune.WeightBSize[1],_Tune.WeightBSize[2],_Tune.WeightBSize[3])i.CustomPhysicalProperties=PhysicalProperties.new((_Tune.Weight*weightScaling-F)/((i.Size.x*i.Size.y)*i.Size.z),0,0,0,0)i.CFrame=((car.DriveSeat.CFrame-car.DriveSeat.Position)+H)*CFrame.new(0,_Tune.CGHeight,0)else end local u=Instance.new("\066\111\100\121\071\121\114\111",car.DriveSeat)u.Name="\070\108\105\112"u.D=0 u.MaxTorque=Vector3.new(0,0,0)u.P=0
--[[Vehicle Weight]]
--Determine Current Mass
local mass = 0

function getMass(p)
	for i, v in pairs(p:GetChildren()) do
		if v:IsA("BasePart") then
			mass = mass + v:GetMass()
		end
		getMass(v)
	end
end
getMass(car)

--Apply Vehicle Weight
if mass < _Tune.Weight * weightScaling then
	--Calculate Weight Distribution
	local centerF = Vector3.new()
	local centerR = Vector3.new()
	local countF = 0
	local countR = 0

	for i, v in pairs(Drive) do
		if v.Name == "FL" or v.Name == "FR" or v.Name == "F" then
			centerF = centerF + v.CFrame.p
			countF = countF + 1
		else
			centerR = centerR + v.CFrame.p
			countR = countR + 1
		end
	end
	centerF = centerF / countF
	centerR = centerR / countR
	local center = centerR:Lerp(centerF, _Tune.WeightDist / 100)

	--Create Weight Brick
	local weightB = Instance.new("Part", car.Body)
	weightB.Name = "#Weight"
	weightB.Anchored = true
	weightB.CanCollide = false
	weightB.BrickColor = BrickColor.new("Really black")
	weightB.TopSurface = Enum.SurfaceType.Smooth
	weightB.BottomSurface = Enum.SurfaceType.Smooth
	if _Tune.WBVisible then
		weightB.Transparency = 0.75
	else
		weightB.Transparency = 1
	end
	weightB.Size = Vector3.new(_Tune.WeightBSize[1], _Tune.WeightBSize[2], _Tune.WeightBSize[3])
	weightB.CustomPhysicalProperties = PhysicalProperties.new(
		((_Tune.Weight * weightScaling) - mass) / (weightB.Size.x * weightB.Size.y * weightB.Size.z),
		0,
		0,
		0,
		0
	)
	weightB.CFrame = (car.DriveSeat.CFrame - car.DriveSeat.Position + center) * CFrame.new(0, _Tune.CGHeight, 0)
else
	--Existing Weight Is Too Massive
end

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