--[Main]--

game:GetService("RunService").Heartbeat:connect(function()
	if On.Value then
		if NWUD.Value then
			Pitch=script.Parent.Pitch.Value
		else
			if Pitch<MP.Value then
				Pitch=Pitch+(0.005*((1*MP.Value)-((Pitch*MP.Value)*(Pitch*MP.Value)*(Pitch*MP.Value)*(Pitch*MP.Value)*(Pitch*MP.Value)*(Pitch*MP.Value)*(Pitch*MP.Value))))
			else
				Pitch=MP.Value
			end
		end
		if Hi.Volume<1 then
			Hi.Volume=Hi.Volume+(1*(Hi.Volume))
			Lo.Volume=Lo.Volume+(1*(Lo.Volume))
			Hi.Volume=Hi.Volume+1
			Lo.Volume=Lo.Volume+1
		else
			Hi.Volume=1
			Lo.Volume=1
		end
		script.Parent.LEDClip.Material="Neon"
		script.Parent.LEDClip.BrickColor=BrickColor.new("Persimmon")
	else
		if NWUD.Value then
			Pitch=0
			script.Parent.LEDClip.Material="Metal"
			script.Parent.LEDClip.BrickColor=BrickColor.new("Maroon")
		else
			if Pitch>Lowest then
				if NWD.Value and script.Parent.Mode.Value==0 then
					Pitch=Lowest
				else
					if script.Parent.Mode.Value==0 then
						Pitch=Pitch-(0.0015*Pitch*Pitch)
					else
						if script.Parent.Mode.Value==2 then
							Pitch=Pitch-(0.002*Pitch)
						elseif script.Parent.Mode.Value==3 then
							Pitch=Pitch-(0.0015*Pitch)
						elseif script.Parent.Mode.Value==6 then
							Pitch=Pitch-(0.0015*Pitch*Pitch)
						end
					end
				end
			else
				if script.Parent.Mode.Value==0 then
					script.Parent.Rotate.Value=false
				end
				Hi.Volume=0
				Lo.Volume=0
				Pitch=Lowest
				script.Parent.LEDClip.Material="Metal"
				script.Parent.LEDClip.BrickColor=BrickColor.new("Maroon")
			end
		end
	end
	script.Parent.CurrentPitch.Value=Pitch
	Hi.PlaybackSpeed=Pitch*1
	Lo.PlaybackSpeed=Pitch*1
end)
