PianoKeysConnections={}ExitButtonConnection=nil SheetsButtonConnection=nil SheetsEditedConnection=nil CapsButtonConnection=nil function MakeGuiConnections()for c,r in pairs(PianoGui.Keys:GetChildren())do PianoKeysConnections[c]=r.InputBegan:connect(function(c)PianoKeyPressed(c,tonumber(r.Name))end)end ExitButtonConnection=PianoGui.ExitButton.InputBegan:connect(ExitButtonPressed)SheetsButtonConnection=PianoGui.SheetsButton.InputBegan:connect(SheetsButtonPressed)SheetsEditedConnection=SheetsGui.Sheet.ScrollingFrame.TextBox.Changed:connect(SheetsEdited)CapsButtonConnection=PianoGui.CapsButton.InputBegan:connect(CapsButtonPressed)end function BreakGuiConnections()for c,r in pairs(PianoKeysConnections)do r:disconnect()end ExitButtonConnection:disconnect()SheetsButtonConnection:disconnect()SheetsEditedConnection:disconnect()CapsButtonConnection:disconnect()end


PianoKeysConnections = {}
ExitButtonConnection = nil
SheetsButtonConnection = nil
SheetsEditedConnection = nil
CapsButtonConnection = 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)
	SheetsEditedConnection = SheetsGui.Sheet.ScrollingFrame.TextBox.Changed:connect(SheetsEdited)
	CapsButtonConnection = PianoGui.CapsButton.InputBegan:connect(CapsButtonPressed)
end
function BreakGuiConnections()
	for i, v in pairs(PianoKeysConnections) do
		v:disconnect()
	end
	
	ExitButtonConnection:disconnect()
	SheetsButtonConnection:disconnect()
	SheetsEditedConnection:disconnect()
	CapsButtonConnection:disconnect()
end
