script.Parent:WaitForChild("\083\112\101\101\100\111")script.Parent:WaitForChild("\084\097\099\104")script.Parent:WaitForChild("\108\110")script.Parent:WaitForChild("\071\101\097\114")script.Parent:WaitForChild("\083\112\101\101\100")local b=script.Parent.Parent.Car.Value b.DriveSeat.HeadsUpDisplay=false local W=require(b["\065-\067\104\097\115\115\105\115 \084\117\110\101"])local X=W.PeakRPM local A=W.Redline local y=8 local T=b.Body.Dash.D.G.Tac.Needle local m=b.Body.Dash.D.G.Spd.Needle local u={}if W.Config=="\070\087\068"or W.Config=="\065\087\068"then if b.Wheels:FindFirstChild("\070\076")~=nil then table.insert(u,b.Wheels.FL)end if b.Wheels:FindFirstChild("\070\082")~=nil then table.insert(u,b.Wheels.FR)end if b.Wheels:FindFirstChild("\070")~=nil then table.insert(u,b.Wheels.F)end end if W.Config=="\082\087\068"or W.Config=="\065\087\068"then if b.Wheels:FindFirstChild("\082\076")~=nil then table.insert(u,b.Wheels.RL)end if b.Wheels:FindFirstChild("\082\082")~=nil then table.insert(u,b.Wheels.RR)end if b.Wheels:FindFirstChild("\082")~=nil then table.insert(u,b.Wheels.R)end end local d=0 for b,W in pairs(u)do if W.Size.x>d then d=W.Size.x end end u=nil local l=math.ceil(((((d*math.pi)*A)/60)/W.Ratios[#W.Ratios])/W.FinalDrive)local Y=160 local F=math.max(math.ceil(Y/200)*20,20)for b=0,y*2,1 do local W=script.Parent.ln:clone()W.Parent=script.Parent.Tach W.Rotation=45+(b*225)/(y*2)W.Num.Text=b/2 W.Num.Rotation=-W.Rotation if b*500>=math.floor(A/500)*500 then W.Frame.BackgroundColor3=Color3.new(1,0,0)if b<y*2 then ln2=W:clone()ln2.Parent=script.Parent.Tach ln2.Rotation=45+((b+.5)*225)/(y*2)ln2.Num:Destroy()ln2.Visible=true end end if b%2==0 then W.Frame.Size=UDim2.new(0,3,0,10)W.Frame.Position=UDim2.new(0,-1,0,100)W.Num.Visible=true else W.Num:Destroy()end W.Visible=true end for b=1,90,1 do local W=script.Parent.ln:clone()W.Parent=script.Parent.Speedo W.Rotation=45+225*(b/90)if b%2==0 then W.Frame.Size=UDim2.new(0,2,0,10)W.Frame.Position=UDim2.new(0,-1,0,100)else W.Frame.Size=UDim2.new(0,3,0,5)end W.Num:Destroy()W.Visible=true end for b=0,Y,F do local W=script.Parent.ln:clone()W.Parent=script.Parent.Speedo W.Rotation=45+225*(b/Y)W.Num.Text=math.floor(b)W.Num.Rotation=-W.Rotation W.Frame:Destroy()W.Num.Visible=true W.Visible=true end if b.DriveSeat.IsOn.Value then script.Parent:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end b.DriveSeat.IsOn.Changed:connect(function()if b.DriveSeat.IsOn.Value then script.Parent:TweenPosition(UDim2.new(0,0,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end end)script.Parent.Parent.Values.RPM.Changed:connect(function()script.Parent.Tach.Needle.Rotation=45+225*math.min(1,script.Parent.Parent.Values.RPM.Value/(y*1000))T.Rotation=-90+(script.Parent.Parent.Values.RPM.Value*270)/8000 end)script.Parent.Parent.Values.Gear.Changed:connect(function()local W=script.Parent.Parent.Values.Gear.Value if W==0 then W="\078"b.Body.Dash.D.G.Info.Gear.Text="\078"elseif W==-1 then W="\082"b.Body.Dash.D.G.Info.Gear.Text="\082"end script.Parent.Gear.Text=W b.Body.Dash.D.G.Info.Gear.Text=W end)script.Parent.Parent.Values.TCS.Changed:connect(function()if script.Parent.Parent.Values.TCS.Value then script.Parent.TCS.TextColor3=Color3.new(1,.66666666666667,0)script.Parent.TCS.TextStrokeColor3=Color3.new(1,.66666666666667,0)if script.Parent.Parent.Values.TCSActive.Value then wait()script.Parent.TCS.Visible=not script.Parent.TCS.Visible else wait()script.Parent.TCS.Visible=false end else script.Parent.TCS.Visible=true script.Parent.TCS.TextColor3=Color3.new(1,0,0)script.Parent.TCS.TextStrokeColor3=Color3.new(1,0,0)end end)script.Parent.Parent.Values.TCSActive.Changed:connect(function()if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then wait()script.Parent.TCS.Visible=not script.Parent.TCS.Visible elseif not script.Parent.Parent.Values.TCS.Value then wait()script.Parent.TCS.Visible=true else wait()script.Parent.TCS.Visible=false end end)script.Parent.TCS.Changed:connect(function()if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then wait()script.Parent.TCS.Visible=not script.Parent.TCS.Visible elseif not script.Parent.Parent.Values.TCS.Value then wait()script.Parent.TCS.Visible=true end end)script.Parent.Parent.Values.PBrake.Changed:connect(function()script.Parent.PBrake.Visible=script.Parent.Parent.Values.PBrake.Value end)script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()if script.Parent.Parent.Values.TransmissionMode.Value=="\065\117\116\111"then script.Parent.TMode.Text="\065\047\084"script.Parent.TMode.BackgroundColor3=Color3.new(1,.66666666666667,0)elseif script.Parent.Parent.Values.TransmissionMode.Value=="\083\101\109\105"then script.Parent.TMode.Text="\083\047\084"script.Parent.TMode.BackgroundColor3=Color3.new(0,.66666666666667,.49803921568627)else script.Parent.TMode.Text="\077\047\084"script.Parent.TMode.BackgroundColor3=Color3.new(1,.33333333333333,.5)end end)script.Parent.Parent.Values.Velocity.Changed:connect(function(b)script.Parent.Speedo.Needle.Rotation=45+225*math.min(1,script.Parent.Parent.Values.Velocity.Value.Magnitude/(Y*1.6))m.Rotation=-90+(script.Parent.Parent.Values.Velocity.Value.Magnitude*270)/256 script.Parent.Speed.Text=math.floor(script.Parent.Parent.Values.Velocity.Value.Magnitude/1.6).." \077\080\072"end)


script.Parent:WaitForChild("Speedo")
script.Parent:WaitForChild("Tach")
script.Parent:WaitForChild("ln")
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")


local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false

local _Tune = require(car["A-Chassis Tune"])

local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline

local revEnd = (8)
local intach = car.Body.Dash.D.G.Tac.Needle
local inspd = car.Body.Dash.D.G.Spd.Needle

local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
	if car.Wheels:FindFirstChild("FL")~= nil then
		table.insert(Drive,car.Wheels.FL)
	end
	if car.Wheels:FindFirstChild("FR")~= nil then
		table.insert(Drive,car.Wheels.FR)
	end
	if car.Wheels:FindFirstChild("F")~= nil then
		table.insert(Drive,car.Wheels.F)
	end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
	if car.Wheels:FindFirstChild("RL")~= nil then
		table.insert(Drive,car.Wheels.RL)
	end
	if car.Wheels:FindFirstChild("RR")~= nil then
		table.insert(Drive,car.Wheels.RR)
	end
	if car.Wheels:FindFirstChild("R")~= nil then
		table.insert(Drive,car.Wheels.R)
	end
end

local wDia = 0
for i,v in pairs(Drive) do
	if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
local maxSpeed = math.ceil(wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
local maxSp = 160
local spInc = math.max(math.ceil(maxSp/200)*20,20)


for i=0,revEnd*2 do
	local ln = script.Parent.ln:clone()
	ln.Parent = script.Parent.Tach
	ln.Rotation = 45 + i * 225 / (revEnd*2)
	ln.Num.Text = i/2
	ln.Num.Rotation = -ln.Rotation
	if i*500>=math.floor(_lRPM/500)*500 then
		ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
		if i<revEnd*2 then
			ln2 = ln:clone()
			ln2.Parent = script.Parent.Tach
			ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
			ln2.Num:Destroy()
			ln2.Visible=true
		end
	end
	if i%2==0 then
		ln.Frame.Size = UDim2.new(0,3,0,10)
		ln.Frame.Position = UDim2.new(0,-1,0,100)
		ln.Num.Visible = true
	else
		ln.Num:Destroy()
	end
	ln.Visible=true
end

for i=1,90 do
	local ln = script.Parent.ln:clone()
	ln.Parent = script.Parent.Speedo
	ln.Rotation = 45 + 225*(i/90)
	if i%2==0 then
		ln.Frame.Size = UDim2.new(0,2,0,10)
		ln.Frame.Position = UDim2.new(0,-1,0,100)
	else
		ln.Frame.Size = UDim2.new(0,3,0,5)
	end
	ln.Num:Destroy()
	ln.Visible=true
end
for i=0,maxSp,spInc do
	local ln = script.Parent.ln:clone()
	ln.Parent = script.Parent.Speedo
	ln.Rotation = 45 + 225*(i/maxSp)
	ln.Num.Text = math.floor(i)
	ln.Num.Rotation = -ln.Rotation
	ln.Frame:Destroy()
	ln.Num.Visible=true
	ln.Visible=true
end

if 	car.DriveSeat.IsOn.Value then
	script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end

car.DriveSeat.IsOn.Changed:connect(function()
	if car.DriveSeat.IsOn.Value then
		script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
	end
end)

script.Parent.Parent.Values.RPM.Changed:connect(function()
	script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
	intach.Rotation = -90 + script.Parent.Parent.Values.RPM.Value * 270 / 8000
end)

script.Parent.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Parent.Values.Gear.Value
	if gearText == 0 then
		gearText = "N"
		car.Body.Dash.D.G.Info.Gear.Text = "N"
	elseif gearText == -1 then
		gearText = "R"
		car.Body.Dash.D.G.Info.Gear.Text = "R"
	end
	script.Parent.Gear.Text = gearText
	car.Body.Dash.D.G.Info.Gear.Text = gearText
end)

script.Parent.Parent.Values.TCS.Changed:connect(function()
	if script.Parent.Parent.Values.TCS.Value then
		script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
		script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
		if script.Parent.Parent.Values.TCSActive.Value then
			wait()
			script.Parent.TCS.Visible = not script.Parent.TCS.Visible
		else
			wait()
			script.Parent.TCS.Visible = false
		end
	else
		script.Parent.TCS.Visible = true
		script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
		script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
	end
end)

script.Parent.Parent.Values.TCSActive.Changed:connect(function()
	if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
		wait()
		script.Parent.TCS.Visible = not script.Parent.TCS.Visible
	elseif not script.Parent.Parent.Values.TCS.Value then
		wait()
		script.Parent.TCS.Visible = true
	else
		wait()
		script.Parent.TCS.Visible = false
	end
end)

script.Parent.TCS.Changed:connect(function()
	if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
		wait()
		script.Parent.TCS.Visible = not script.Parent.TCS.Visible
	elseif not script.Parent.Parent.Values.TCS.Value then
		wait()
		script.Parent.TCS.Visible = true
	end
end)

script.Parent.Parent.Values.PBrake.Changed:connect(function()
	script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end)

script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()
	if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
		script.Parent.TMode.Text = "A/T"
		script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
	elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
		script.Parent.TMode.Text = "S/T"
		script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255) 
	else
		script.Parent.TMode.Text = "M/T"
		script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
	end
end)

script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
	script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,script.Parent.Parent.Values.Velocity.Value.Magnitude/(maxSp*1.6))
	inspd.Rotation = -90 + script.Parent.Parent.Values.Velocity.Value.Magnitude * 270 / 256
	script.Parent.Speed.Text = math.floor(script.Parent.Parent.Values.Velocity.Value.Magnitude/1.6) .. " MPH"
end)
