Advertisement
Crimsxn_K1ra

New AutoHotkey Roblox Piano Autoplayer AHK Script (v1.2)

Jul 10th, 2025
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. #SingleInstance Force
  2. #Persistent
  3.  
  4. Gui, +AlwaysOnTop
  5. Gui, Add, Text,, ============Roblox Virtual Piano In-Game Styled Autoplayer (v 1.2)============
  6. Gui, Add, Text,, -----------------------------------------------PASTE SHEETS HERE------------------------------------------------
  7. Gui, Add, Edit, R10 w400 vPianoMusic gSheetChanged
  8. Gui, Add, Text,, Keybinds: - (Minus), = (Equals), [ (Left Bracket), ] (Right Bracket)
  9. Gui, Add, Text,, Click the "Play" button to activate the keybinds. Click "Stop" to deactivate.
  10. Gui, Add, Text,, Press the keybinds to begin autoplaying. You'll need to play by rhythm.
  11. Gui, Add, Text,, Based on the old AutoHotkey Roblox Piano Autoplayer (the one with F4 and F8)
  12. Gui, Add, Text,, (This also works in Virtual Pianos outside of Roblox Virtual Piano games.)
  13. Gui, Add, Text,, Modifications done by: Crimsxn K1ra
  14. Gui, Add, Text,, ------------------------------------------------------------Progress------------------------------------------------------------
  15. Gui, Add, Edit, ReadOnly w400 vNextNotes
  16. Gui, Add, Button, vTogglePlayStopButton gTogglePlayStop, Play
  17. Gui, Show
  18.  
  19. PianoMusic := ""
  20. CurrentPos := 1
  21. DisplayPos := 1
  22. KeyPressStartTime := 0
  23. KeyDelay := 0.1
  24. isPlaying := false
  25.  
  26. Suspend, On
  27.  
  28. PlayNextNote()
  29. {
  30. global PianoMusic, CurrentPos, DisplayPos, KeyDelay, KeyPressStartTime
  31. Gui, Submit, Nohide
  32. DisplayMusic := PianoMusic
  33. PianoMusic := RegExReplace(PianoMusic, "`n|`r|/| ")
  34.  
  35. if (CurrentPos > StrLen(PianoMusic))
  36. {
  37. CurrentPos := 1
  38. DisplayPos := 1
  39. }
  40.  
  41. if (CurrentPos <= StrLen(PianoMusic) && A_TickCount - KeyPressStartTime < 3000)
  42. {
  43. if (RegExMatch(PianoMusic, "U)(\[.*]|.)", Keys, CurrentPos))
  44. {
  45. CurrentPos += StrLen(Keys)
  46.  
  47. while (DisplayPos <= StrLen(DisplayMusic) && InStr(" `n`r/", SubStr(DisplayMusic, DisplayPos, 1)))
  48. DisplayPos++
  49.  
  50. DisplayPos += StrLen(Keys)
  51.  
  52. Keys := Trim(Keys, "[]")
  53. SendInput, {Raw}%Keys%
  54.  
  55. NextNotes := SubStr(DisplayMusic, DisplayPos, 90)
  56. GuiControl,, NextNotes, %NextNotes%
  57.  
  58. Sleep, %KeyDelay%
  59. }
  60. }
  61. }
  62.  
  63. -::
  64. =::
  65. [::
  66. ]::
  67. KeyPressStartTime := A_TickCount
  68. PlayNextNote()
  69. KeyPressStartTime := 0
  70. return
  71.  
  72. TogglePlayStop:
  73. isPlaying := !isPlaying
  74. if (isPlaying)
  75. {
  76. Suspend, Off
  77. GuiControl,, TogglePlayStopButton, Stop
  78. }
  79. else
  80. {
  81. Suspend, On
  82. GuiControl,, TogglePlayStopButton, Play
  83. CurrentPos := 1
  84. DisplayPos := 1
  85. GuiControl,, NextNotes
  86. }
  87. return
  88.  
  89. SheetChanged:
  90. Gui, Submit, Nohide
  91. CurrentPos := 1
  92. DisplayPos := 1
  93. GuiControl,, NextNotes
  94. return
  95.  
  96. GuiClose:
  97. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement