function GetTireCurve(V,L)return(-math.abs(L^(V*2.4))/2.4+-math.abs(L^2.4)/2.4)*1.1666666666667 end function WFriction(V,L)if V.CustomPhysicalProperties==nil then V.CustomPhysicalProperties=PhysicalProperties.new(V.Material)end V.CustomPhysicalProperties=PhysicalProperties.new(0,L,0,0,0)end;(Instance.new("\077\111\100\101\108",fWheel.Parts)).Name="\084\105\114\101\115";(Instance.new("\077\111\100\101\108",rWheel.Parts)).Name="\084\105\114\101\115"for V=0,_Tune.TireCylinders,1 do local L=fWheel:Clone()L.Name="\070\084\105\114\101"for V,L in pairs(L:GetChildren())do L:Destroy()end L.Parent=fWheel.Parts.Tires if _Tune.TiresVisible or _Tune.Debug then L.Transparency=0 else L.Transparency=1 end L.Size=Vector3.new(fWheel.Size.X*(V/_Tune.TireCylinders),fWheel.Size.Y+_Tune.FProfileHeight*GetTireCurve(_Tune.FTireProfile,V/_Tune.TireCylinders),fWheel.Size.Y+_Tune.FProfileHeight*GetTireCurve(_Tune.FTireProfile,V/_Tune.TireCylinders))if V/_Tune.TireCylinders<.33333333333333 and _Tune.FTireCompound==3 or V/_Tune.TireCylinders<.5 and _Tune.FTireCompound==2 then WFriction(L,_Tune.FTireFriction-.1)L.Name=L.Name.."\076"elseif V/_Tune.TireCylinders>=.33333333333333 and(V/_Tune.TireCylinders<.66666666666667 and _Tune.FTireCompound==3)then WFriction(L,(_Tune.FTireFriction+(_Tune.FTireFriction-.1))/2)L.Name=L.Name.."\077"elseif V/_Tune.TireCylinders>=.66666666666667 or V/_Tune.TireCylinders>=.5 and _Tune.FTireCompound==2 or _Tune.FTireCompound==1 then WFriction(L,_Tune.FTireFriction)L.Name=L.Name.."\072"end local B=rWheel:Clone()B.Name="\082\084\105\114\101"for V,L in pairs(B:GetChildren())do L:Destroy()end B.Parent=rWheel.Parts.Tires if _Tune.TiresVisible or _Tune.Debug then B.Transparency=0 else B.Transparency=1 end B.Size=Vector3.new(rWheel.Size.X*(V/_Tune.TireCylinders),rWheel.Size.Y+_Tune.RProfileHeight*GetTireCurve(_Tune.RTireProfile,V/_Tune.TireCylinders),rWheel.Size.Y+_Tune.RProfileHeight*GetTireCurve(_Tune.RTireProfile,V/_Tune.TireCylinders))if V/_Tune.TireCylinders<.33333333333333 and _Tune.RTireCompound==3 or V/_Tune.TireCylinders<.5 and _Tune.RTireCompound==2 then WFriction(B,_Tune.RTireFriction-.1)B.Name=B.Name.."\076"elseif V/_Tune.TireCylinders>=.33333333333333 and(V/_Tune.TireCylinders<.66666666666667 and _Tune.RTireCompound==3)then WFriction(B,(_Tune.RTireFriction+(_Tune.RTireFriction-.1))/2)B.Name=B.Name.."\077"elseif V/_Tune.TireCylinders>=.66666666666667 or V/_Tune.TireCylinders>=.5 and _Tune.RTireCompound==2 or _Tune.RTireCompound==1 then WFriction(B,_Tune.RTireFriction)B.Name=B.Name.."\072"end wait()end fWheel.CanCollide=false fWheel.Transparency=1 rWheel.CanCollide=false rWheel.Transparency=1
--Tires
function GetTireCurve(c, x)
	return (((-math.abs(x ^ (c * 2.4))) / 2.4) + ((-math.abs(x ^ 2.4)) / 2.4)) * (7 / 6)
end

function WFriction(v, val)
	if v.CustomPhysicalProperties == nil then
		v.CustomPhysicalProperties = PhysicalProperties.new(v.Material)
	end
	v.CustomPhysicalProperties = PhysicalProperties.new(0, val, 0, 0, 0)
end

Instance.new("Model", fWheel.Parts).Name = "Tires"
Instance.new("Model", rWheel.Parts).Name = "Tires"

for i = 0, _Tune.TireCylinders do
	local fCyl = fWheel:Clone()
	fCyl.Name = "FTire"
	for _, a in pairs(fCyl:GetChildren()) do
		a:Destroy()
	end
	fCyl.Parent = fWheel.Parts.Tires
	if _Tune.TiresVisible or _Tune.Debug then
		fCyl.Transparency = 0
	else
		fCyl.Transparency = 1
	end
	fCyl.Size = Vector3.new(
		fWheel.Size.X * (i / _Tune.TireCylinders),
		fWheel.Size.Y + (_Tune.FProfileHeight * GetTireCurve(_Tune.FTireProfile, i / _Tune.TireCylinders)),
		fWheel.Size.Y + (_Tune.FProfileHeight * GetTireCurve(_Tune.FTireProfile, i / _Tune.TireCylinders))
	)

	if
		(i / _Tune.TireCylinders < 1 / 3 and _Tune.FTireCompound == 3)
		or (i / _Tune.TireCylinders < 1 / 2 and _Tune.FTireCompound == 2)
	then
		WFriction(fCyl, _Tune.FTireFriction - 0.1)
		fCyl.Name = fCyl.Name .. "L"
	elseif i / _Tune.TireCylinders >= 1 / 3 and i / _Tune.TireCylinders < 2 / 3 and _Tune.FTireCompound == 3 then
		WFriction(fCyl, (_Tune.FTireFriction + (_Tune.FTireFriction - 0.1)) / 2)
		fCyl.Name = fCyl.Name .. "M"
	elseif
		i / _Tune.TireCylinders >= 2 / 3
		or (i / _Tune.TireCylinders >= 1 / 2 and _Tune.FTireCompound == 2)
		or _Tune.FTireCompound == 1
	then
		WFriction(fCyl, _Tune.FTireFriction)
		fCyl.Name = fCyl.Name .. "H"
	end

	local rCyl = rWheel:Clone()
	rCyl.Name = "RTire"
	for _, b in pairs(rCyl:GetChildren()) do
		b:Destroy()
	end
	rCyl.Parent = rWheel.Parts.Tires
	if _Tune.TiresVisible or _Tune.Debug then
		rCyl.Transparency = 0
	else
		rCyl.Transparency = 1
	end
	rCyl.Size = Vector3.new(
		rWheel.Size.X * (i / _Tune.TireCylinders),
		rWheel.Size.Y + (_Tune.RProfileHeight * GetTireCurve(_Tune.RTireProfile, i / _Tune.TireCylinders)),
		rWheel.Size.Y + (_Tune.RProfileHeight * GetTireCurve(_Tune.RTireProfile, i / _Tune.TireCylinders))
	)

	if
		(i / _Tune.TireCylinders < 1 / 3 and _Tune.RTireCompound == 3)
		or (i / _Tune.TireCylinders < 1 / 2 and _Tune.RTireCompound == 2)
	then
		WFriction(rCyl, _Tune.RTireFriction - 0.1)
		rCyl.Name = rCyl.Name .. "L"
	elseif i / _Tune.TireCylinders >= 1 / 3 and i / _Tune.TireCylinders < 2 / 3 and _Tune.RTireCompound == 3 then
		WFriction(rCyl, (_Tune.RTireFriction + (_Tune.RTireFriction - 0.1)) / 2)
		rCyl.Name = rCyl.Name .. "M"
	elseif
		i / _Tune.TireCylinders >= 2 / 3
		or (i / _Tune.TireCylinders >= 1 / 2 and _Tune.RTireCompound == 2)
		or _Tune.RTireCompound == 1
	then
		WFriction(rCyl, _Tune.RTireFriction)
		rCyl.Name = rCyl.Name .. "H"
	end

	wait()
end

fWheel.CanCollide = false
fWheel.Transparency = 1
rWheel.CanCollide = false
rWheel.Transparency = 1
