using { /Fortnite.com/Devices } using { /Fortnite.com/Devices/Patchwork } # This is our main script. It lives on a Verse Device. # We give it a name so we can find it later. MyMusicBox := class(VerseDevice): # We need to tell Verse where our devices are. # Think of these as "slots" for your gadgets. ButtonInput := property( Get(): return Button ) # This is the Note Sequencer. It holds the notes. Sequencer := property( Get(): return NoteSeq ) # This is the speaker that makes sound. Speaker := property( Get(): return InstrumentPlayer ) # When the game starts, we set up our music. OnBegin(): # Let's make a simple scale: Do, Re, Mi, Fa. # We use the Sequencer to set these notes. Sequencer.SetNotes([ Note{Pitch: 60, Duration: 0.5}, Note{Pitch: 62, Duration: 0.5}, Note{Pitch: 64, Duration: 0.5}, Note{Pitch: 65, Duration: 0.5} ]) # Connect the Sequencer to the Speaker. # This is like plugging a cable into a socket. Sequencer.Outputs.NoteOutput.Connect(Speaker.Inputs.NoteInput) # This function runs when the button is pressed. OnButtonPressed(): # Tell the Sequencer to start playing! Sequencer.Play()