Mr_3242

RNG Fights auto farm (semi functional) and auto roll

Apr 6th, 2026 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.60 KB | Gaming | 0 0
  1. --------------------------------------------------
  2. -- CLEAN RE-EXECUTE
  3. --------------------------------------------------
  4. if getgenv().AutoFarmUnload then
  5.     pcall(getgenv().AutoFarmUnload)
  6. end
  7.  
  8. --------------------------------------------------
  9. -- LOAD RAYFIELD
  10. --------------------------------------------------
  11. local Rayfield
  12.  
  13. repeat
  14.     local s,r = pcall(function()
  15.         return loadstring(game:HttpGet("https://sirius.menu/rayfield"))()
  16.     end)
  17.  
  18.     if s and r then
  19.         Rayfield = r
  20.     else
  21.         task.wait(0.5)
  22.     end
  23. until Rayfield
  24.  
  25. --------------------------------------------------
  26. -- FILTER NOTIFICATIONS
  27. --------------------------------------------------
  28. local oldNotify = Rayfield.Notify
  29.  
  30. Rayfield.Notify = function(self,data)
  31.     if data and data.Title then
  32.         local t = tostring(data.Title)
  33.  
  34.         if t:find("Rayfield") or t:find("Interface") then
  35.             return
  36.         end
  37.     end
  38.  
  39.     return oldNotify(self,data)
  40. end
  41.  
  42. --------------------------------------------------
  43. -- NOTIFY
  44. --------------------------------------------------
  45. local function Notify(t,c)
  46.     Rayfield:Notify({
  47.         Title=t,
  48.         Content=c,
  49.         Duration=3,
  50.         Image=4483362458
  51.     })
  52. end
  53.  
  54. --------------------------------------------------
  55. -- WINDOW
  56. --------------------------------------------------
  57. local Window = Rayfield:CreateWindow({
  58.     Name = "RNG Fights",
  59.     LoadingTitle = "auto farm + auto roll",
  60.     LoadingSubtitle = "follow me on TikTok Mr_3242",
  61.     ConfigurationSaving = { Enabled = false },
  62.     KeySystem = false
  63. })
  64.  
  65. local Tab = Window:CreateTab("Main",4483362458)
  66. local CreditsTab = Window:CreateTab("Credits",4483362458)
  67. local UnloadTab = Window:CreateTab("Unload",4483362458)
  68.  
  69. local Status = Tab:CreateLabel("Status: Idle")
  70.  
  71. --------------------------------------------------
  72. -- SERVICES
  73. --------------------------------------------------
  74. local Players = game:GetService("Players")
  75. local Rep = game:GetService("ReplicatedStorage")
  76. local VIM = game:GetService("VirtualInputManager")
  77.  
  78. local player = Players.LocalPlayer
  79.  
  80. local events = Rep:WaitForChild("EventsFolder")
  81. local attacksFolder = Rep:WaitForChild("AttacksFolder")
  82.  
  83. local rollRemote = events:WaitForChild("GenerateAttack")
  84. local updateRemote = events:WaitForChild("UpdateAttack")
  85.  
  86. local teleporter = workspace.Game.Lobby.Teleporter
  87.  
  88. --------------------------------------------------
  89. -- STATE
  90. --------------------------------------------------
  91. local AutoRoll = false
  92. local AutoFarm = false
  93. local Rolling = false
  94. local StopAfterAbility = nil
  95. local currentAttack = nil
  96. local running = true
  97.  
  98. _G.SkipArenaPhase = false
  99.  
  100. --------------------------------------------------
  101. -- TRACK ATTACK
  102. --------------------------------------------------
  103. updateRemote.OnClientEvent:Connect(function(name)
  104.     currentAttack = name
  105. end)
  106.  
  107. --------------------------------------------------
  108. -- AUTO ROLL
  109. --------------------------------------------------
  110. local function startAutoRoll()
  111.     task.spawn(function()
  112.         while AutoRoll and running do
  113.             task.wait()
  114.  
  115.             rollRemote:FireServer("Random")
  116.  
  117.             if StopAfterAbility and currentAttack == StopAfterAbility then
  118.                 AutoRoll = false
  119.                 Rolling = false
  120.                 Status:Set("Stopped at "..StopAfterAbility)
  121.             end
  122.         end
  123.     end)
  124. end
  125.  
  126. --------------------------------------------------
  127. -- WAIT FOR TELEPORT
  128. --------------------------------------------------
  129.  
  130. local function waitForTeleport(hrp)
  131.     local start = hrp.Position
  132.  
  133.     for i = 1, 50 do
  134.         task.wait(0.1)
  135.  
  136.         if _G.SkipArenaPhase then
  137.             _G.SkipArenaPhase = false
  138.             return true
  139.         end
  140.  
  141.         if (hrp.Position - start).Magnitude > 50 then
  142.             return true
  143.         end
  144.     end
  145.  
  146.     return false
  147. end
  148.  
  149. --------------------------------------------------
  150. -- TARGET SYSTEM
  151. --------------------------------------------------
  152. local function getTarget(hrp)
  153.     local best, dist = nil, math.huge
  154.  
  155.     for _,plr in pairs(Players:GetPlayers()) do
  156.         if plr ~= player and plr.Character then
  157.  
  158.             local hum = plr.Character:FindFirstChild("Humanoid")
  159.             local hrp2 = plr.Character:FindFirstChild("HumanoidRootPart")
  160.  
  161.             if hum and hrp2 and hum.Health > 0 then
  162.  
  163.                 local yDifference = hrp2.Position.Y - hrp.Position.Y
  164.  
  165.                 if yDifference <= 30 then
  166.                     local d = (hrp.Position - hrp2.Position).Magnitude
  167.  
  168.                     if d < dist then
  169.                         dist = d
  170.                         best = plr
  171.                     end
  172.                 end
  173.             end
  174.         end
  175.     end
  176.  
  177.     return best
  178. end
  179.  
  180. --------------------------------------------------
  181. -- AUTO FARM
  182. --------------------------------------------------
  183. local function startAutoFarm()
  184.     task.spawn(function()
  185.  
  186.         while AutoFarm and running do
  187.  
  188.             local char = player.Character or player.CharacterAdded:Wait()
  189.             local hum = char:WaitForChild("Humanoid")
  190.             local hrp = char:WaitForChild("HumanoidRootPart")
  191.  
  192.             Status:Set("Going to teleporter...")
  193.  
  194.             --------------------------------------------------
  195.             -- TELEPORTER CHECK
  196.             --------------------------------------------------
  197.             local teleporterYDifference = teleporter.Position.Y - hrp.Position.Y
  198.  
  199.             if teleporterYDifference >= 30 then
  200.                 _G.SkipArenaPhase = true
  201.                 Status:Set("Skipping teleporter (too high)")
  202.             else
  203.  
  204.                 _G.SkipArenaPhase = false
  205.  
  206.                 pcall(function()
  207.                     hum:MoveTo(teleporter.Position)
  208.                 end)
  209.  
  210.                 local success = waitForTeleport(hrp)
  211.  
  212.                 pcall(function()
  213.                     hum:Move(Vector3.zero)
  214.                 end)
  215.  
  216.                 if not success then
  217.                     task.wait(1)
  218.                     continue
  219.                 end
  220.             end
  221.  
  222.             --------------------------------------------------
  223.             -- ARENA PHASE
  224.             --------------------------------------------------
  225.             Status:Set("Arena ⚔️")
  226.  
  227.             while AutoFarm and hum.Health > 0 and running do
  228.                 task.wait(0.1)
  229.  
  230.                 if hum.Sit then
  231.                     hum.Sit = false
  232.                     hum:ChangeState(Enum.HumanoidStateType.Jumping)
  233.                 end
  234.  
  235.                 rollRemote:FireServer("Random")
  236.  
  237.                 if StopAfterAbility and currentAttack == StopAfterAbility then
  238.                     AutoRoll = false
  239.                     Rolling = false
  240.                     Status:Set("Stopped at "..StopAfterAbility)
  241.                 end
  242.  
  243.                 local target = getTarget(hrp)
  244.  
  245.                 if target then
  246.                     local enemyHRP = target.Character:FindFirstChild("HumanoidRootPart")
  247.                     if enemyHRP then
  248.                         hum:MoveTo(enemyHRP.Position)
  249.                     end
  250.                 end
  251.  
  252.                 if currentAttack then
  253.                     for _,tool in pairs(player.Backpack:GetChildren()) do
  254.                         if tool.Name == currentAttack then
  255.                             tool.Parent = char
  256.                         end
  257.                     end
  258.                 end
  259.  
  260.                 VIM:SendMouseButtonEvent(0,0,0,true,game,0)
  261.                 VIM:SendMouseButtonEvent(0,0,0,false,game,0)
  262.  
  263.                 VIM:SendKeyEvent(true,Enum.KeyCode.Q,false,game)
  264.                 VIM:SendKeyEvent(false,Enum.KeyCode.Q,false,game)
  265.             end
  266.  
  267.             Status:Set("Respawning...")
  268.  
  269.             repeat task.wait()
  270.             until player.Character
  271.             and player.Character:FindFirstChild("Humanoid")
  272.             and player.Character.Humanoid.Health > 0
  273.  
  274.             Status:Set("Restarting...")
  275.             task.wait(1)
  276.         end
  277.     end)
  278. end
  279.  
  280. --------------------------------------------------
  281. -- ABILITIES
  282. --------------------------------------------------
  283. local abilities = {}
  284.  
  285. for _,v in pairs(attacksFolder:GetChildren()) do
  286.     if v:IsA("Folder") and v.Name ~= "Admin" then
  287.         if v:FindFirstChild("Tool") then
  288.             table.insert(abilities,v.Name)
  289.         end
  290.     end
  291. end
  292.  
  293. --------------------------------------------------
  294. -- UI
  295. --------------------------------------------------
  296. Tab:CreateToggle({
  297.     Name = "Auto Farm (semi functional)",
  298.     CurrentValue = false,
  299.     Callback = function(v)
  300.         AutoFarm = v
  301.         if v then startAutoFarm() end
  302.     end
  303. })
  304.  
  305. Tab:CreateToggle({
  306.     Name = "Auto Roll",
  307.     CurrentValue = false,
  308.     Callback = function(v)
  309.         AutoRoll = v
  310.         Rolling = v
  311.         if v then startAutoRoll() end
  312.     end
  313. })
  314.  
  315. Tab:CreateDropdown({
  316.     Name = "Stop Roll At Ability",
  317.     Options = abilities,
  318.     Callback = function(opt)
  319.         StopAfterAbility = opt
  320.     end
  321. })
  322.  
  323. Tab:CreateParagraph({
  324.     Title = "⚠️ use if auto farm broke ⚠️",
  325.     Content = "Teleporter phase will be skipped if you click the button under this note"
  326. })
  327.  
  328. Tab:CreateButton({
  329.     Name = "Skip To Arena Phase",
  330.     Callback = function()
  331.         _G.SkipArenaPhase = true
  332.         Status:Set("Arena ⚔️")
  333.     end
  334. })
  335.  
  336. --------------------------------------------------
  337. -- CREDITS
  338. --------------------------------------------------
  339. CreditsTab:CreateParagraph({
  340.     Title="Credits",
  341.     Content="Script created by Mr_3242\nThanks for using the script!"
  342. })
  343.  
  344. CreditsTab:CreateButton({
  345.     Name="Copy TikTok Link",
  346.     Callback=function()
  347.         setclipboard("https://www.tiktok.com/@Mr_3242")
  348.         Notify("Copied","TikTok link copied")
  349.     end
  350. })
  351.  
  352. CreditsTab:CreateButton({
  353.     Name="Copy YouTube Link",
  354.     Callback=function()
  355.         setclipboard("https://www.youtube.com/@Mr_3242.")
  356.         Notify("Copied","YouTube link copied")
  357.     end
  358. })
  359.  
  360. CreditsTab:CreateButton({
  361.     Name="Copy Twitch Link",
  362.     Callback=function()
  363.         setclipboard("https://m.twitch.tv/quantumx_42/home")
  364.         Notify("Copied","Twitch link copied")
  365.     end
  366. })
  367.  
  368. --------------------------------------------------
  369. -- UNLOAD
  370. --------------------------------------------------
  371. getgenv().AutoFarmUnload = function()
  372.     running = false
  373.     AutoFarm = false
  374.     AutoRoll = false
  375.     Rolling = false
  376.  
  377.     pcall(function()
  378.         Rayfield:Destroy()
  379.     end)
  380.  
  381.     getgenv().AutoFarmUnload = nil
  382. end
  383.  
  384. UnloadTab:CreateButton({
  385.     Name = "Unload Script",
  386.     Callback = function()
  387.         getgenv().AutoFarmUnload()
  388.     end
  389. })
Tags: delta
Advertisement
Add Comment
Please, Sign In to add comment