Advertisement
scripter99793

funky friday

Jun 9th, 2021
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.51 KB | None | 0 0
  1. -- updated 5/12/21
  2. -- should choke less
  3.  
  4. -- updated 5/16/21
  5. -- should ignore invisible notes
  6. -- added hit chances and a toggle
  7. -- hit chances are a bit rough but should work good enough
  8.  
  9. -- only tested on Synapse X
  10. local library = loadstring(game:HttpGet("https://pastebin.com/raw/edJT9EGX"))()
  11.  
  12. local framework, scrollHandler
  13. while true do
  14.     for _, obj in next, getgc(true) do
  15.         if type(obj) == 'table' and rawget(obj, 'GameUI') then
  16.             framework = obj;
  17.             break
  18.         end
  19.     end
  20.  
  21.     for _, module in next, getloadedmodules() do
  22.         if module.Name == 'ScrollHandler' then
  23.             scrollHandler = module;
  24.             break;
  25.         end
  26.     end
  27.  
  28.     if (type(framework) == 'table') and (typeof(scrollHandler) == 'Instance') then
  29.         break
  30.     end
  31.  
  32.     wait(1)
  33. end
  34.  
  35. local runService = game:GetService('RunService')
  36. local userInputService = game:GetService('UserInputService')
  37. local client = game:GetService('Players').LocalPlayer;
  38. local random = Random.new()
  39.  
  40. local fastWait, fastSpawn, fireSignal, rollChance do
  41.     -- https://eryn.io/gist/3db84579866c099cdd5bb2ff37947cec
  42.     -- bla bla spawn and wait are bad
  43.     -- can also use bindables for the fastspawn idc
  44.  
  45.     function fastWait(t)
  46.         local d = 0;
  47.         while d < t do
  48.             d += runService.RenderStepped:wait()
  49.         end
  50.     end
  51.  
  52.     function fastSpawn(f)
  53.         coroutine.wrap(f)()
  54.     end
  55.  
  56.     function fireSignal(target, signal, ...)
  57.         -- getconnections with InputBegan / InputEnded does not work without setting Synapse to the game's context level
  58.         syn.set_thread_identity(2)
  59.         for _, signal in next, getconnections(signal) do
  60.             if type(signal.Function) == 'function' and islclosure(signal.Function) then
  61.                 local scr = rawget(getfenv(signal.Function), 'script')
  62.                 if scr == target then
  63.                     pcall(signal.Function, ...)
  64.                 end
  65.             end
  66.         end
  67.         syn.set_thread_identity(7)
  68.     end
  69.  
  70.     -- uses a weighted random system
  71.     -- its a bit scuffed rn but it works good enough
  72.  
  73.     function rollChance()
  74.         local chances = {
  75.             { type = 'Sick', value = library.flags.sickChance },
  76.             { type = 'Good', value = library.flags.goodChance },
  77.             { type = 'Ok', value = library.flags.okChance },
  78.             { type = 'Bad', value = library.flags.badChance },
  79.         }
  80.        
  81.         table.sort(chances, function(a, b)
  82.             return a.value > b.value
  83.         end)
  84.  
  85.         local sum = 0;
  86.         for i = 1, #chances do
  87.             sum += chances[i].value
  88.         end
  89.  
  90.         if sum == 0 then
  91.             return choices[random:NextInteger(1, #choices)]
  92.         end
  93.  
  94.         local initialWeight = random:NextInteger(0, sum)
  95.         local weight = 0;
  96.  
  97.         for i = 1, #chances do
  98.             weight = weight + chances[i].value
  99.  
  100.             if weight > initialWeight then
  101.                 return chances[i].type
  102.             end
  103.         end
  104.  
  105.         return 'Sick' -- just incase it fails?
  106.     end
  107. end
  108.  
  109. local map = { [0] = 'Left', [1] = 'Down', [2] = 'Up', [3] = 'Right', }
  110. local keys = { Up = Enum.KeyCode.Up; Down = Enum.KeyCode.Down; Left = Enum.KeyCode.Left; Right = Enum.KeyCode.Right; }
  111.  
  112. -- they are "weird" because they are in the middle of their Upper & Lower ranges
  113. -- should hopefully make them more precise!
  114. local chanceValues = {
  115.     Sick = 96,
  116.     Good = 92,
  117.     Ok = 87,
  118.     Bad = 77,
  119. }
  120.  
  121. local marked = {}
  122. local hitChances = {}
  123.  
  124. if shared._id then
  125.     pcall(runService.UnbindFromRenderStep, runService, shared._id)
  126. end
  127.  
  128. shared._id = game:GetService('HttpService'):GenerateGUID(false)
  129. runService:BindToRenderStep(shared._id, 1, function()
  130.     if (not library.flags.autoPlayer) then return end
  131.  
  132.     for i, arrow in next, framework.UI.ActiveSections do
  133.         if (arrow.Side == framework.UI.CurrentSide) and (not marked[arrow]) then
  134.             local indice = (arrow.Data.Position % 4) -- mod 4 because 5%4 -> 0, 6%4 = 1, etc
  135.             local position = map[indice]
  136.            
  137.             if (position) then
  138.                 local currentTime = framework.SongPlayer.CurrentlyPlaying.TimePosition
  139.                 local distance = (1 - math.abs(arrow.Data.Time - currentTime)) * 100
  140.  
  141.                 if (arrow.Data.Time == 0) then
  142.                 --  print('invisible', tableToString(arrow.Data), i, distance)
  143.                     continue
  144.                 end
  145.  
  146.                 local hitChance = hitChances[arrow] or rollChance()
  147.                 hitChances[arrow] = hitChance
  148.  
  149.                 -- if (not chanceValues[hitChance]) then warn('invalid chance', hitChance) end
  150.                 if distance >= chanceValues[hitChance] then
  151.                     marked[arrow] = true;
  152.                     fireSignal(scrollHandler, userInputService.InputBegan, { KeyCode = keys[position], UserInputType = Enum.UserInputType.Keyboard }, false)
  153.  
  154.                     -- wait depending on the arrows length so the animation can play
  155.                     if arrow.Data.Length > 0 then
  156.                         fastWait(arrow.Data.Length)
  157.                     else
  158.                         fastWait(0.065) -- 0.1 seems to make it miss more, this should be fine enough?
  159.                     end
  160.  
  161.                     fireSignal(scrollHandler, userInputService.InputEnded, { KeyCode = keys[position], UserInputType = Enum.UserInputType.Keyboard }, false)
  162.                     marked[arrow] = false;
  163.                 end
  164.             end
  165.         end
  166.     end
  167. end)
  168.  
  169. local window = library:CreateWindow('Funky Friday') do
  170.     local folder = window:AddFolder('Main') do
  171.         folder:AddToggle({ text = 'Autoplayer', flag = 'autoPlayer' })
  172.  
  173.         folder:AddSlider({ text = 'Sick %', flag = 'sickChance', min = 0, max = 100, value = 100 })
  174.         folder:AddSlider({ text = 'Good %', flag = 'goodChance', min = 0, max = 100, value = 0 })
  175.         folder:AddSlider({ text = 'Ok %', flag = 'okChance', min = 0, max = 100, value = 0 })
  176.         folder:AddSlider({ text = 'Bad %', flag = 'badChance', min = 0, max = 100, value = 0 })
  177.     end
  178.  
  179.     local folder = window:AddFolder('Credits') do
  180.         folder:AddLabel({ text = 'Credits' })
  181.         folder:AddLabel({ text = 'Jan - UI library' })
  182.         folder:AddLabel({ text = 'wally - Script' })
  183.     end
  184. end
  185.  
  186.  
  187. library:Init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement