if script.Parent.Parent.Parent.IsOn.Value then script.Parent:TweenPosition(UDim2.new(.95,0,1,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end script.Parent.Parent.Parent.IsOn.Changed:connect(function()if script.Parent.Parent.Parent.IsOn.Value then script.Parent:TweenPosition(UDim2.new(.95,0,1,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)end end)script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()script.Parent.Tach.Needle.Rotation=43+215*math.min(1,script.Parent.Parent.Parent.Values.RPM.Value/(revEnd*1000))end)script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()local t=script.Parent.Parent.Parent.Values.Gear.Value if t==0 then t="\078"elseif t==-1 then t="\082"end script.Parent.Gear.Text=t end)script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()local t=script.Parent.Parent.Parent.Values.Gear.Value if t>=1 then script.Parent.GearImage.ImageColor3=Color3.new(0,1,.4)elseif t==-1 then script.Parent.GearImage.ImageColor3=Color3.new(1,1,1)end script.Parent.Gear.Text=t end)script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()local t=script.Parent.Parent.Parent.Values.Gear.Value if t>=1 then script.Parent.Gear.TextColor3=Color3.new(0,1,.4)elseif t==-1 then script.Parent.Gear.TextColor3=Color3.new(1,1,1)end script.Parent.Gear.Text=t end)script.Parent.Tach.Needle.Changed:Connect(function()if script.Parent.Tach.Needle.Rotation>=235 then script.Parent.GearImage.ImageColor3=Color3.new(1,.16,.16)script.Parent.Gear.TextColor3=Color3.new(1,.16,.16)elseif script.Parent.Tach.Needle.Rotation<220 then script.Parent.GearImage.ImageColor3=script.Parent.GearImage.ImageColor3 script.Parent.Gear.TextColor3=script.Parent.Gear.TextColor3 end end)function Speed()local t=script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude local Z=.56818181818182 local u=.9144 if SpeedType=="\077\080\072"then if t*Z<100 then if t*Z<10 then script.Parent.Speed.Text="\048\048"..math.floor(t*Z)else script.Parent.Speed.Text="\048"..math.floor(t*Z)end else script.Parent.Speed.Text=math.floor(t*Z)end end end script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()script.Parent.Tach.Needle.Rotation=215*math.min(1,script.Parent.Parent.Parent.Values.RPM.Value/(revEnd*1000))end)script.Parent.Parent.Parent.Values.Velocity.Changed:connect(function()Speed()end)wait(.1)Speed()
--[[for i=0,revEnd*2 do
	local ln = script.Parent.ln:clone()
	ln.Parent = script.Parent.Tach
	ln.ZIndex = 4
	ln.Rotation = 45 + i * 225 / (revEnd*2)
	ln.Num.Text = i/2
	ln.Num.Rotation = -ln.Rotation
	if i*500>=math.floor(_pRPM/500)*500 then
		ln.Frame.BackgroundColor3 = Color3.new(0.862745, 0.0784314, 0.235294)
		if i<revEnd*2 then
			ln2 = ln:clone()
			ln2.ZIndex = 2
			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]]

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

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

script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()
	script.Parent.Tach.Needle.Rotation = 43
		+ 215 * math.min(1, script.Parent.Parent.Parent.Values.RPM.Value / (revEnd * 1000))
end)

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

script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Parent.Parent.Values.Gear.Value
	if gearText >= 1 then
		script.Parent.GearImage.ImageColor3 = Color3.new(0, 1, 0.4)
	elseif gearText == -1 then
		script.Parent.GearImage.ImageColor3 = Color3.new(1, 1, 1)
	end
	script.Parent.Gear.Text = gearText
end)

script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
	local gearText = script.Parent.Parent.Parent.Values.Gear.Value
	if gearText >= 1 then
		script.Parent.Gear.TextColor3 = Color3.new(0, 1, 0.4)
	elseif gearText == -1 then
		script.Parent.Gear.TextColor3 = Color3.new(1, 1, 1)
	end
	script.Parent.Gear.Text = gearText
end)

script.Parent.Tach.Needle.Changed:Connect(function()
	if script.Parent.Tach.Needle.Rotation >= 235 then
		script.Parent.GearImage.ImageColor3 = Color3.new(1, 0.16, 0.16)
		script.Parent.Gear.TextColor3 = Color3.new(1, 0.16, 0.16)
	elseif script.Parent.Tach.Needle.Rotation < 220 then
		script.Parent.GearImage.ImageColor3 = script.Parent.GearImage.ImageColor3
		script.Parent.Gear.TextColor3 = script.Parent.Gear.TextColor3
	end
end)

function Speed()
	local SpeedVal = script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude
	local MPHScale = (10 / 12) * (60 / 88)
	local KPHScale = (10 / 12) * 1.09728
	if SpeedType == "MPH" then
		if SpeedVal * MPHScale < 100 then
			if SpeedVal * MPHScale < 10 then
				script.Parent.Speed.Text = "00" .. math.floor(SpeedVal * MPHScale)
			else
				script.Parent.Speed.Text = "0" .. math.floor(SpeedVal * MPHScale)
			end
		else
			script.Parent.Speed.Text = math.floor(SpeedVal * MPHScale)
		end
	end
end

script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()
	script.Parent.Tach.Needle.Rotation = 215
		* math.min(1, script.Parent.Parent.Parent.Values.RPM.Value / (revEnd * 1000))
end)

script.Parent.Parent.Parent.Values.Velocity.Changed:connect(function()
	Speed()
end)

wait(0.1)
Speed()
