local VirtualInputManager = game:GetService("VirtualInputManager") local UserInputService = game:GetService("UserInputService") -- ▼▼▼ ur note here. ▼▼▼ local sheetMusic = [[ [o@(YPD] P [o@(YPD] [o@YP] s [P5wyod] [E5yo] o [%WYts] [t%YP] O [5wEYP] [5EY] Y [W4qti] [W4ti] o [t@(O] [t@O] [tP] [@(ts] [29yd] [18YD] [^Pidg] [%W] [5w] [4qP] [@(PDoh] [P5wig] [YD] [^EPidg] q [9id] [y^P] [18osYD] [@(od] s [5wyod] 9 [^yo] [E5o] [%WYts] [4qtYP] [WO] [5wEYP] [5wEY] Y [4qpYD] [Y4qod] [ps] [y^EP] [%WPd] [5wsD] [4qdg] [@(PDoh] [29] [@(] [4q] [5wdPgJ] [sD] [P5wd] [sD] [^Edg] [PJ] [PJ] [PJ] [^PJ] [qyiP] [yi^P] [Pd] [s%WD] [5wdg] [18osYD] 5 [18] [29] [@(Podh] [ps] [o@P] [ps] [P5wd] [5oh] [oh] [oh] [^oh] [E9yo] [E5yo] [oP] [O4qs] [^Pd] [s%YD] [Os] [@(] [Pd] [8tsYD] [Os] [^E] [Pd] [s%WYD] [YOs] [s@(OD] [8tsODH] [^EOH] [OH] [OH] [%WOH] [5wOH] [4qsgOH] 5 % [^EPdh] g [s^OD] [Pdg] [@(PDoh] [29] [@(] [5woPD] [4qoPD] [@(YP] [YP] [29YP] [18YP] [29ipsg] [ps] @ 4 [5woaD] d [5ips] [oad] [18osYD] 2 @ [Y4os] [Y8tos] [Yo] [^E] [Yo] [s%WYD] [P4qd] [Os] [5wYP] [5EY] Y [4qpYD] [Y4od] Y [ps] [y^EP] [y^O] P [o@(YPD] [o@YP] s [P5wyod] [E5yo] o [%WYts] [t%YP] O [5wEYP] [5EY] Y [W4qti] [W4ti] o [t@(O] [t@O] [tP] [@(ts] [29yd] [18YD] [^Pidg] [%W] [5w] [4qP] [@(PDoh] [P5wig] [YD] [^EPidg] q [9id] [y^P] [18osYD] [@(od] s [5wyod] 9 [^yo] [E5o] [%WYts] [4qtYP] [WO] [5wEYP] [5wEY] Y [4qpYD] [Y4qod] [ps] [y^EP] [%WPd] [5wsD] [4qdg] [@(PDoh] [29] [@(] [4q] [5wdPJg] [sD] [P5wd] [sD] [^Edg] [PJ] [PJ] [PJ] [^PJ] [qyiP] [yi^P] [Pd] [s%WD] [5wdg] [18osYD] 5 [18] [29] [@(Pohd] [ps] [o@P] [ps] [P5wd] [5oh] [oh] [oh] [^oh] [E9yo] [E5yo] [oP] [O4qs] [^Pd] [s%YD] [Os] [@(] [Pd] [8tsYD] [Os] [^E] [Pd] [s%WYD] [YOs] [s@(OD] [8tsODH] [^EOH] [OH] [OH] [%WOH] [5wOH] [4qsgOH] 5 % [^EPdh] g [s^OD] [Pdg] [@(PDoh] [29] [@(] [5woPD] [4qoPD] [@(YP] [YP] [29YP] [18YP] [29ipsg] [ps] @ 4 [5woaD] d [5ips] [oad] [18osYD] 2 @ [Y4os] [Y8tos] [Yo] [^E] [Yo] [s%WYD] [P4qd] [Os] [5wEYP] [5EY] Y [y^EOP] [%OPts] [^Oyid] [o@YPD] ]] -- ▲▲▲ and ends here. ▲▲▲ local notes = {} for word in sheetMusic:gmatch("%S+") do table.insert(notes, word) end local isOn = false local currentIndex = 1 local isPlaying = false local shiftMap = { ['!'] = Enum.KeyCode.One, ['@'] = Enum.KeyCode.Two, ['#'] = Enum.KeyCode.Three, ['$'] = Enum.KeyCode.Four, ['%'] = Enum.KeyCode.Five, ['^'] = Enum.KeyCode.Six, ['&'] = Enum.KeyCode.Seven, ['*'] = Enum.KeyCode.Eight, ['('] = Enum.KeyCode.Nine, [')'] = Enum.KeyCode.Zero, ['_'] = Enum.KeyCode.Minus, ['+'] = Enum.KeyCode.Equals, ['{'] = Enum.KeyCode.LeftBracket, ['}'] = Enum.KeyCode.RightBracket, ['|'] = Enum.KeyCode.BackSlash, [':'] = Enum.KeyCode.Semicolon, ['"'] = Enum.KeyCode.Quote, ['<'] = Enum.KeyCode.Comma, ['>'] = Enum.KeyCode.Period, ['?'] = Enum.KeyCode.Slash, ['~'] = Enum.KeyCode.Tilde } local function getKeyCode(char) if shiftMap[char] then return shiftMap[char] end if char:match("%a") then return Enum.KeyCode[char:upper()] end if char:match("%d") then local numToName = {["1"]="One", ["2"]="Two", ["3"]="Three", ["4"]="Four", ["5"]="Five", ["6"]="Six", ["7"]="Seven", ["8"]="Eight", ["9"]="Nine", ["0"]="Zero"} return Enum.KeyCode[numToName[char]] end local map = { ['-'] = Enum.KeyCode.Minus, ['='] = Enum.KeyCode.Equals, ['['] = Enum.KeyCode.LeftBracket, [']'] = Enum.KeyCode.RightBracket, ['\\'] = Enum.KeyCode.BackSlash, [';'] = Enum.KeyCode.Semicolon, ['\''] = Enum.KeyCode.Quote, [','] = Enum.KeyCode.Comma, ['.'] = Enum.KeyCode.Period, ['/'] = Enum.KeyCode.Slash, ['`'] = Enum.KeyCode.Backquote } return map[char] end -- 高速化されたグループ演奏関数 local function playKeyGroup(chars, needsShift) if #chars == 0 then return end if needsShift then VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.LeftShift, false, game) task.wait(0.001) -- 遅延を極限まで短縮 end local pressedKeys = {} for _, char in ipairs(chars) do local keyCode = getKeyCode(char) if keyCode then VirtualInputManager:SendKeyEvent(true, keyCode, false, game) table.insert(pressedKeys, keyCode) end end task.wait(0.01) -- 歯切れよく聴こえるようにキープ時間を短縮 for _, keyCode in ipairs(pressedKeys) do VirtualInputManager:SendKeyEvent(false, keyCode, false, game) end if needsShift then task.wait(0.001) -- 遅延を極限まで短縮 VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.LeftShift, false, game) task.wait(0.001) end end local function playNoteOrChord(noteStr) local shiftChars = {} local normalChars = {} local chordStr = noteStr if noteStr:sub(1, 1) == "[" and noteStr:sub(-1, -1) == "]" then chordStr = noteStr:sub(2, -2) end for i = 1, #chordStr do local char = chordStr:sub(i, i) -- 元の判定基準(大文字 or 登録された記号)に戻す local isUpper = (char:match("%u") ~= nil) or (shiftMap[char] ~= nil) if isUpper then table.insert(shiftChars, char) else table.insert(normalChars, char) end end -- グループを分けて叩くが、間のウエイトを極限まで減らしたため、ほぼ同時に聴こえるはずです if #shiftChars > 0 then playKeyGroup(shiftChars, true) end if #normalChars > 0 then playKeyGroup(normalChars, false) end end UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.UserInputType == Enum.UserInputType.MouseButton2 then isOn = not isOn game.StarterGui:SetCore("SendNotification", { Title = "Auto Player"; Text = isOn and "✅ 起動しました (ON)" or "❌ 停止しました (OFF)"; Duration = 3; }) end if input.KeyCode == Enum.KeyCode.Minus and not gameProcessed then if isOn and not isPlaying then if currentIndex <= #notes then task.spawn(function() isPlaying = true playNoteOrChord(notes[currentIndex]) currentIndex = currentIndex + 1 isPlaying = false end) else game.StarterGui:SetCore("SendNotification", { Title = "Auto Player"; Text = "the note inside the script is fully played!"; Duration = 3; }) end end end end)