VincentYee

FNF Autoplayer (ROBLOX)

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