Advertisement
Vzurxy

fnf auto player

Feb 25th, 2021 (edited)
46,516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.35 KB | None | 0 0
  1. if not writefile or not readfile then
  2.     local hint = Instance.new("Hint")
  3.     hint.Text = "your exploit doesn't support saving, go get a better exploit or something 😭😭"
  4.     hint.Parent = game:GetService("CoreGui")
  5.     coroutine.wrap(function() wait(10) hint:Destroy() end)()
  6. end
  7.  
  8. local getcontext = syn and syn.get_thread_identity or getthreadcontext
  9. local setcontext = syn and syn.set_thread_identity or setthreadcontext
  10. local material = loadstring(game:HttpGet("https://raw.githubusercontent.com/Kinlei/MaterialLua/master/Module.lua"))()
  11. local HttpService = game:GetService("HttpService")
  12. local wait = wait;
  13. local cowrap = coroutine.wrap;
  14. local rnd = math.random;
  15.  
  16. local vim = game:GetService("VirtualInputManager")
  17. local uis = game:GetService("UserInputService")
  18. local plr = game:GetService("Players").LocalPlayer
  19. local root = plr.Character.HumanoidRootPart
  20.  
  21. local del = 0.2
  22.  
  23. local ui = material.Load({
  24.     Title = "fnf auto player | discord.gg/WuQE59cGAb",
  25.     Style = 1,
  26.     SizeX = 400,
  27.     SizeY = 400,
  28.     Theme = "Dark"
  29. })
  30.  
  31. local cgui = game:GetService("CoreGui"):WaitForChild("fnf auto player | discord.gg/WuQE59cGAb")
  32.  
  33. local main = ui.New({
  34.     Title = "Main"
  35. })
  36.  
  37. local delspeed = main.Slider({
  38.     Text = "Del Speed (Divide By 100)",
  39.     Callback = function(value)
  40.         del = value / 100
  41.     end,
  42.     Min = 1,
  43.     Max = 100,
  44.     Def = 20
  45. })
  46.  
  47. local fov = main.Slider({
  48.     Text = "FOV",
  49.     Callback = function(value)
  50.         workspace.Camera.FieldOfView = value
  51.     end,
  52.     Min = 0,
  53.     Max = 120,
  54.     Def = 70
  55. })
  56.  
  57. local name = main.TextField({
  58.     Text = "Name",
  59. })
  60.  
  61. local delay = main.TextField({
  62.     Text = "Del Value 1 - 100",
  63. })
  64.  
  65. local save = main.Button({
  66.     Text = "Save",
  67.     Callback = function()
  68.         local savedName = name:GetText()
  69.         local savedDelay = tonumber(delay:GetText())
  70.        
  71.         if not savedDelay then return end -- prevent funky monkey
  72.        
  73.         local save, result = pcall(readfile, "fnfAutoplayer.json")
  74.         if not save then
  75.             local saved = {savedName = savedDelay}
  76.             writefile("fnfAutoPlayer.json", HttpService:JSONEncode(saved))
  77.         else
  78.             result = HttpService:JSONDecode(result)
  79.             result[savedName] = savedDelay
  80.             writefile("fnfAutoPlayer.json", HttpService:JSONEncode(result))
  81.         end
  82.  
  83.         main.Button({
  84.             Text = ("%s | %s"):format(savedName, savedDelay),
  85.             Callback = function()
  86.                 del = delay / 100
  87.             end
  88.         })
  89.     end
  90. })
  91.  
  92. local overrideJson = main.Toggle({
  93.     Text = "Override JSON",
  94.     Callback = function() end,
  95.     Enabled = false
  96. })
  97.  
  98. local load;
  99. load = main.TextField({
  100.     Text = "Load JSON Config",
  101.     Callback = function()
  102.         local text = load:GetText()
  103.         if not pcall(HttpService.JSONDecode, HttpService, text) then
  104.             load:SetText("invalid json")
  105.         else
  106.             if overrideJson:GetState() then
  107.                 writefile("fnfAutoPlayer.json", text)
  108.             end
  109.             local result = HttpService:JSONDecode(text)
  110.             for name, delay in pairs(result) do
  111.                 main.Button({
  112.                     Text = ("%s | %s"):format(name, delay),
  113.                     Callback = function()
  114.                         del = delay / 100
  115.                     end
  116.                 })
  117.             end
  118.            
  119.             load:SetText("")
  120.         end
  121.     end
  122. })
  123.  
  124. local chanceToHit;
  125. local chanceNum = 100;
  126.  
  127. chanceToHit = main.TextField({
  128.     Text = "Chance To Hit (0 - 100)%",
  129.     Callback = function()
  130.         local chance = tonumber(chanceToHit:GetText())
  131.         if chance and chance >= 0 and chance <= 100 then
  132.             chanceNum = chance
  133.         end
  134.     end
  135. })
  136.  
  137. local delConfig = main.Button({
  138.     Text = "Delete Config",
  139.     Callback = function()
  140.         pcall(delfile, "fnfAutoPlayer.json")
  141.         game:GetService("TeleportService"):TeleportToPlaceInstance(game.PlaceId, game.JobId, plr)
  142.     end
  143. })
  144.  
  145. local enabled = main.Toggle({
  146.     Text = "Enabled",
  147.     Callback = function() end,
  148.     Enabled = true
  149. })
  150.  
  151. local save, result = pcall(readfile, "fnfAutoplayer.json")
  152. if save then
  153.     result = HttpService:JSONDecode(result)
  154.     for name, delay in pairs(result) do
  155.         main.Button({
  156.             Text = ("%s | %s"):format(name, delay),
  157.             Callback = function()
  158.                 del = delay / 100
  159.             end
  160.         })
  161.     end
  162. end
  163.  
  164. local function getpos()
  165.     local parts = workspace.Stages:GetDescendants()
  166.     local nearest = nil;
  167.     local closest = 0;
  168.    
  169.     for i,v in pairs(parts) do
  170.         if v.Name:sub(1, 1) == "P" and v:IsA("BasePart") then
  171.             if closest < (root.Position - v.Position).Magnitude then
  172.                 nearest = v
  173.                 closest = (root.Position - v.Position).Magnitude
  174.             end
  175.         end
  176.     end
  177.    
  178.     return nearest.Name:gsub("%D+", "")
  179. end
  180.  
  181. local keymap = {
  182.     ["U"] = Enum.KeyCode.W,
  183.     ["D"] = Enum.KeyCode.S,
  184.     ["L"] = Enum.KeyCode.A,
  185.     ["R"] = Enum.KeyCode.D
  186. }
  187.  
  188. local player = game:GetService("Players").LocalPlayer
  189. local gui = player.PlayerGui
  190.  
  191. local function hit(key, await)
  192.     if not enabled:GetState() then return end
  193.     if (rnd() * 100) >= chanceNum then return end
  194.     wait(2 / await - del)
  195.     vim:SendKeyEvent(true, keymap[key], false, game)
  196.     vim:SendKeyEvent(false, keymap[key], false, game)
  197. end
  198.  
  199. uis.InputBegan:Connect(function(input, gpe)
  200.     if gpe then return end
  201.     if input.KeyCode == Enum.KeyCode.RightShift and cgui then
  202.         cgui.Enabled = not cgui.Enabled
  203.     end
  204. end)
  205.  
  206. gui.ChildAdded:Connect(function(ui)
  207.     if ui.Name:lower():find("fnf") then
  208.         local scr = ui:WaitForChild("FNFMain")
  209.         local succ, env = pcall(getsenv, scr)
  210.  
  211.         if not succ then
  212.             wait(2)
  213.             succ, env = pcall(getsenv, scr)
  214.         end
  215.        
  216.         local orig = env.Note
  217.         local our = getpos();
  218.        
  219.         env.Note = function(key, opp, await)
  220.             local old = getcontext()
  221.             setcontext(7)
  222.            
  223.             local turn = opp:gsub("%D+", "")
  224.             if tonumber(our) == tonumber(turn) then
  225.                 cowrap(hit)(key, await)
  226.             end
  227.            
  228.             setcontext(old)
  229.            
  230.             return orig(key, opp, await)
  231.         end
  232.     end
  233. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement