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

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-.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-.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-.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-.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


