PianoKeysConnections={}ExitButtonConnection=nil SheetsButtonConnection=nil CapsButtonConnection=nil TransDnConnection=nil TransUpConnection=nil VolumeUpConnection=nil VolumeDownConnection=nil function MakeGuiConnections()for Z,w in pairs(PianoGui.Keys:GetChildren())do PianoKeysConnections[Z]=w.InputBegan:connect(function(Z)PianoKeyPressed(Z,tonumber(w.Name))end)end ExitButtonConnection=PianoGui.ExitButton.InputBegan:connect(ExitButtonPressed)SheetsButtonConnection=PianoGui.SheetsButton.InputBegan:connect(SheetsButtonPressed)CapsButtonConnection=PianoGui.CapsButton.InputBegan:connect(CapsButtonPressed)TransDnConnection=PianoGui.TransDnButton.MouseButton1Click:connect(function()Transpose(-1)end)TransUpConnection=PianoGui.TransUpButton.MouseButton1Click:connect(function()Transpose(1)end)VolumeUpConnection=PianoGui.VolumeUpButton.MouseButton1Click:connect(function()VolumeChange(.1)end)VolumeDownConnection=PianoGui.VolumeDownButton.MouseButton1Click:connect(function()VolumeChange(-0.1)end)end function BreakGuiConnections()for Z,w in pairs(PianoKeysConnections)do w:disconnect()end ExitButtonConnection:disconnect()SheetsButtonConnection:disconnect()CapsButtonConnection:disconnect()end
----------------------------------
-----------CONNECTIONS------------
----------------------------------

PianoKeysConnections = {}
ExitButtonConnection = nil
SheetsButtonConnection = nil
CapsButtonConnection = nil
TransDnConnection = nil
TransUpConnection = nil
VolumeUpConnection = nil
VolumeDownConnection = nil

function MakeGuiConnections()
	for i, v in pairs(PianoGui.Keys:GetChildren()) do
		PianoKeysConnections[i] = v.InputBegan:connect(function(Object)
			PianoKeyPressed(Object, tonumber(v.Name))
		end)
	end

	ExitButtonConnection = PianoGui.ExitButton.InputBegan:connect(ExitButtonPressed)
	SheetsButtonConnection = PianoGui.SheetsButton.InputBegan:connect(SheetsButtonPressed)
	CapsButtonConnection = PianoGui.CapsButton.InputBegan:connect(CapsButtonPressed)

	TransDnConnection = PianoGui.TransDnButton.MouseButton1Click:connect(function()
		Transpose(-1)
	end)

	TransUpConnection = PianoGui.TransUpButton.MouseButton1Click:connect(function()
		Transpose(1)
	end)

	VolumeUpConnection = PianoGui.VolumeUpButton.MouseButton1Click:connect(function()
		VolumeChange(0.1)
	end)

	VolumeDownConnection = PianoGui.VolumeDownButton.MouseButton1Click:connect(function()
		VolumeChange(-0.1)
	end)
end
function BreakGuiConnections()
	for i, v in pairs(PianoKeysConnections) do
		v:disconnect()
	end

	ExitButtonConnection:disconnect()
	SheetsButtonConnection:disconnect()
	CapsButtonConnection:disconnect()
end
