PianoKeysConnections={}ExitButtonConnection=nil SheetsButtonConnection=nil CapsButtonConnection=nil TransDnConnection=nil TransUpConnection=nil VolumeUpConnection=nil VolumeDownConnection=nil function MakeGuiConnections()for g,L in pairs(PianoGui.Keys:GetChildren())do PianoKeysConnections[g]=L.InputBegan:connect(function(g)PianoKeyPressed(g,tonumber(L.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 g,L in pairs(PianoKeysConnections)do L:disconnect()end ExitButtonConnection:disconnect()SheetsButtonConnection:disconnect()CapsButtonConnection:disconnect()end


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(.1)
	end)
	
	VolumeDownConnection = PianoGui.VolumeDownButton.MouseButton1Click:connect(function()
		VolumeChange(-.1)
	end)
end
function BreakGuiConnections()
	for i, v in pairs(PianoKeysConnections) do
		v:disconnect()
	end
	
	ExitButtonConnection:disconnect()
	SheetsButtonConnection:disconnect()
	CapsButtonConnection:disconnect()
end
