Advertisement
aesnike

perplexity AUTO-Farm

Oct 28th, 2024 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.76 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local gui = nil
  3. local mainFrame = nil
  4. local closeButton = nil
  5.  
  6. -- Save file path (relative to the exploit's workspace)
  7. local saveFilePath = "settings.txt"
  8.  
  9. -- Function to load settings from the save file
  10. local function loadSettings()
  11. local success, data = pcall(function()
  12. return game:GetService("HttpService"):JSONDecode(readfile(saveFilePath))
  13. end)
  14. if success then
  15. return data
  16. else
  17. return {}
  18. end
  19. end
  20.  
  21. -- Function to save settings to the save file
  22. local function saveSettings(settings)
  23. local success, _ = pcall(function()
  24. writefile(saveFilePath, game:GetService("HttpService"):JSONEncode(settings))
  25. end)
  26. end
  27.  
  28. -- Function to make an object draggable
  29. local function makeDraggable(object)
  30. local UserInputService = game:GetService("UserInputService")
  31. local dragging
  32. local dragInput
  33. local dragStart
  34. local startPos
  35.  
  36. local function update(input)
  37. local delta = input.Position - dragStart
  38. object.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  39. end
  40.  
  41. object.InputBegan:Connect(function(input)
  42. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  43. dragging = true
  44. dragStart = input.Position
  45. startPos = object.Position
  46.  
  47. input.Changed:Connect(function()
  48. if input.UserInputState == Enum.UserInputState.End then
  49. dragging = false
  50. end
  51. end)
  52. end
  53. end)
  54.  
  55. object.InputChanged:Connect(function(input)
  56. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  57. dragInput = input
  58. end
  59. end)
  60.  
  61. UserInputService.InputChanged:Connect(function(input)
  62. if input == dragInput and dragging then
  63. update(input)
  64. end
  65. end)
  66. end
  67.  
  68. -- Function to create the GUI
  69. local function createGui()
  70. if gui then gui:Destroy() end
  71.  
  72. local ScreenGui = Instance.new("ScreenGui")
  73. local MainFrame = Instance.new("Frame")
  74. local CloseButton = Instance.new("TextButton")
  75.  
  76. ScreenGui.Name = "PersistentGUI"
  77. ScreenGui.ResetOnSpawn = false
  78. ScreenGui.DisplayOrder = 999999999
  79. ScreenGui.Parent = player.PlayerGui
  80.  
  81. CloseButton.Size = UDim2.new(0, 150, 0, 50)
  82. CloseButton.Position = UDim2.new(0.5, -75, 0, 10)
  83. CloseButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  84. CloseButton.Text = "Open/Close"
  85. CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  86. CloseButton.Font = Enum.Font.SourceSansBold
  87. CloseButton.TextSize = 18
  88. CloseButton.Parent = ScreenGui
  89. CloseButton.ZIndex = 10
  90.  
  91. local corner = Instance.new("UICorner")
  92. corner.CornerRadius = UDim.new(0.5, 0)
  93. corner.Parent = CloseButton
  94.  
  95. MainFrame.Size = UDim2.new(0.3, 0, 0.5, 0)
  96. MainFrame.Position = UDim2.new(0.5, -150, 0, 80)
  97. MainFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  98. MainFrame.BackgroundTransparency = 0.5
  99. MainFrame.BorderSizePixel = 0
  100. MainFrame.ClipsDescendants = true
  101. MainFrame.Visible = true
  102. MainFrame.ZIndex = 1
  103. MainFrame.Parent = ScreenGui
  104.  
  105. local UIGridLayout = Instance.new("UIGridLayout")
  106. UIGridLayout.Parent = MainFrame
  107. UIGridLayout.CellSize = UDim2.new(0.45, 0, 0, 30)
  108. UIGridLayout.CellPadding = UDim2.new(0.05, 0, 0.05, 0)
  109. UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
  110. UIGridLayout.FillDirectionMaxCells = 2
  111.  
  112. local frameCorner = Instance.new("UICorner")
  113. frameCorner.CornerRadius = UDim.new(0.05, 0)
  114. frameCorner.Parent = MainFrame
  115.  
  116. -- Make CloseButton and MainFrame draggable
  117. makeDraggable(CloseButton)
  118. makeDraggable(MainFrame)
  119.  
  120. -- Load saved settings
  121. local savedSettings = loadSettings()
  122.  
  123. -- Function to create toggle buttons
  124. local function createToggleButton(number, name, onClick)
  125. local button = Instance.new("TextButton")
  126. button.Size = UDim2.new(1, 0, 1, 0)
  127. button.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  128. button.Text = name
  129. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  130. button.Font = Enum.Font.SourceSansBold
  131. button.TextSize = 14
  132. button.LayoutOrder = number
  133. button.Parent = MainFrame
  134. button.ZIndex = 2
  135.  
  136. local corner = Instance.new("UICorner")
  137. corner.CornerRadius = UDim.new(0.3, 0)
  138. corner.Parent = button
  139.  
  140. local isEnabled = savedSettings[name] or false
  141. button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
  142.  
  143. if isEnabled then
  144. onClick(true)
  145. end
  146.  
  147. button.MouseButton1Click:Connect(function()
  148. isEnabled = not isEnabled
  149. button.BackgroundColor3 = isEnabled and Color3.fromRGB(0, 0, 255) or Color3.fromRGB(0, 0, 0)
  150. savedSettings[name] = isEnabled
  151. saveSettings(savedSettings)
  152. onClick(isEnabled)
  153. end)
  154.  
  155. return button
  156. end
  157.  
  158. -- Kill Aura Function
  159. local killAuraActive = false
  160. local killAuraLoop = nil
  161. local function toggleKillAura(isEnabled)
  162. killAuraActive = isEnabled
  163. if isEnabled then
  164. if not killAuraLoop then
  165. killAuraLoop = spawn(function()
  166. while killAuraActive do
  167. local args = {
  168. [1] = {
  169. [1] = {
  170. ["animationLength"] = 0,
  171. ["sentAt"] = tick()
  172. },
  173. [2] = "G"
  174. }
  175. }
  176. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
  177. wait(0)
  178. end
  179. end)
  180. end
  181. else
  182. killAuraActive = false
  183. killAuraLoop = nil
  184. end
  185. end
  186.  
  187. -- New TP Function
  188. local tpActive = false
  189. local tpLoop = nil
  190. local LocalPlayer = game.Players.LocalPlayer
  191. local Character = LocalPlayer.Character
  192. local targetNPC = nil
  193. local targetCoin = nil
  194. local coinTouchedTime = 0
  195. local coinStayDuration = 1
  196. local waitTimeIfNoMobs = 1
  197. local delay = 2
  198. local offset = Vector3.new(0, 9, 0)
  199.  
  200. local function freezeCharacters()
  201. for _, player in pairs(game.Players:GetPlayers()) do
  202. if player.Character and player.Character:FindFirstChild('Humanoid') then
  203. player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Frozen)
  204. end
  205. end
  206. end
  207.  
  208. local function unfreezeCharacters()
  209. for _, player in pairs(game.Players:GetPlayers()) do
  210. if player.Character and player.Character:FindFirstChild('Humanoid') then
  211. player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
  212. end
  213. end
  214. end
  215.  
  216. local function findNearestNPC()
  217. local nearestNPC = nil
  218. local nearestDistance = math.huge
  219.  
  220. Character = LocalPlayer.Character
  221. if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
  222.  
  223. for _, folder in ipairs(workspace:GetChildren()) do
  224. if folder:IsA("Folder") then
  225. for _, child in ipairs(folder:GetChildren()) do
  226. if child:FindFirstChild("enemyFolder") then
  227. for _, npc in ipairs(child.enemyFolder:GetChildren()) do
  228. if npc:FindFirstChild("HumanoidRootPart") and npc:FindFirstChild("Humanoid") and npc.Humanoid.Health > 0 then
  229. local distance = (Character.HumanoidRootPart.Position - npc.HumanoidRootPart.Position).Magnitude
  230. if distance < nearestDistance then
  231. nearestDistance = distance
  232. nearestNPC = npc
  233. end
  234. end
  235. end
  236. end
  237. end
  238. end
  239. end
  240. return nearestNPC
  241. end
  242.  
  243. local function findNearestCoin()
  244. if workspace:FindFirstChild("Coin") and workspace.Coin:FindFirstChild("Coin") then
  245. return workspace.Coin.Coin
  246. end
  247. return nil
  248. end
  249.  
  250. local function stayOnTopOfTarget()
  251. if targetCoin and targetCoin.Parent then
  252. if Character and Character:FindFirstChild("HumanoidRootPart") then
  253. Character.HumanoidRootPart.CFrame = targetCoin.CFrame
  254.  
  255. if coinTouchedTime == 0 then
  256. coinTouchedTime = tick()
  257. end
  258.  
  259. if tick() - coinTouchedTime > coinStayDuration then
  260. targetCoin = nil
  261. coinTouchedTime = 0
  262. end
  263. end
  264. elseif not targetNPC or not targetNPC.Parent or not targetNPC:FindFirstChild("HumanoidRootPart") then
  265. targetNPC = findNearestNPC()
  266. if not targetNPC then
  267. wait(waitTimeIfNoMobs)
  268. return
  269. end
  270. elseif Character and Character:FindFirstChild("HumanoidRootPart") and targetNPC and targetNPC:FindFirstChild("HumanoidRootPart") then
  271. local npcPosition = targetNPC.HumanoidRootPart.Position
  272. local lookVector = (npcPosition - Character.HumanoidRootPart.Position).Unit
  273. local cframe = CFrame.new(npcPosition + offset, npcPosition)
  274. Character.HumanoidRootPart.CFrame = cframe
  275. end
  276. end
  277.  
  278. local function toggleTP(isEnabled)
  279. tpActive = isEnabled
  280. if isEnabled then
  281. freezeCharacters()
  282. if not tpLoop then
  283. tpLoop = spawn(function()
  284. local lastTeleportTime = 0
  285. while tpActive do
  286. stayOnTopOfTarget()
  287.  
  288. local currentTime = tick()
  289. if currentTime - lastTeleportTime >= delay then
  290. lastTeleportTime = currentTime
  291. targetCoin = findNearestCoin()
  292. if not targetCoin then
  293. targetNPC = findNearestNPC()
  294. end
  295. end
  296.  
  297. wait(0.1)
  298. end
  299. unfreezeCharacters()
  300. end)
  301. end
  302. else
  303. tpActive = false
  304. tpLoop = nil
  305. unfreezeCharacters()
  306. end
  307. end
  308.  
  309. -- Auto-Ability Function
  310. local abilityActive = false
  311. local abilityLoop = nil
  312. local function toggleAbility(isEnabled)
  313. abilityActive = isEnabled
  314. if isEnabled then
  315. if not abilityLoop then
  316. abilityLoop = spawn(function()
  317. local VirtualInputManager = game:GetService("VirtualInputManager")
  318. local lastKeyPress = 0
  319. local keyPressCooldown = 0.5
  320.  
  321. while abilityActive do
  322. local Character = player.Character
  323. if Character and Character:FindFirstChild("HumanoidRootPart") then
  324. local function isNearMobs(range)
  325. for _, folder in ipairs(workspace:GetChildren()) do
  326. if folder:IsA("Folder") then
  327. for _, child in ipairs(folder:GetChildren()) do
  328. if child:FindFirstChild("enemyFolder") then
  329. for _, npc in ipairs(child.enemyFolder:GetChildren()) do
  330. if npc:FindFirstChild("HumanoidRootPart") and npc:FindFirstChild("Humanoid") and npc.Humanoid.Health > 0 then
  331. local distance = (Character.HumanoidRootPart.Position - npc.HumanoidRootPart.Position).Magnitude
  332. if distance <= range then
  333. return true
  334. end
  335. end
  336. end
  337. end
  338. end
  339. end
  340. end
  341. return false
  342. end
  343.  
  344. if isNearMobs(20) and tick() - lastKeyPress >= keyPressCooldown then
  345. VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, nil)
  346. task.wait()
  347. VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, nil)
  348.  
  349. VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.Q, false, nil)
  350. task.wait()
  351. VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.Q, false, nil)
  352.  
  353. lastKeyPress = tick()
  354. end
  355. end
  356. wait(0.1)
  357. end
  358. end)
  359. end
  360. else
  361. abilityActive = false
  362. abilityLoop = nil
  363. end
  364. end
  365.  
  366. -- Auto-retry function
  367. local autoRetryActive = false
  368. local function toggleAutoRetry(isEnabled)
  369. autoRetryActive = isEnabled
  370. if isEnabled then
  371. local function checkForEndScreen()
  372. local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
  373. local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
  374.  
  375. if retryVote and retryVote.Enabled then
  376. wait(1)
  377. local voteArgs = {
  378. [1] = {
  379. [1] = {
  380. ["\3"] = "vote",
  381. ["vote"] = true
  382. },
  383. [2] = "."
  384. }
  385. }
  386. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
  387. elseif revivePrompt and revivePrompt.Enabled then
  388. wait(1)
  389. local reviveArgs = {
  390. [1] = {
  391. [1] = {
  392. ["\3"] = "closeRevive"
  393. },
  394. [2] = "\13"
  395. }
  396. }
  397. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
  398. end
  399. end
  400.  
  401. player.PlayerGui.ChildAdded:Connect(function(child)
  402. if autoRetryActive and (child.Name == "RetryVote" or child.Name == "RevivePrompt") then
  403. checkForEndScreen()
  404. end
  405. end)
  406.  
  407. checkForEndScreen()
  408. end
  409. end
  410.  
  411. -- Auto-Play Function
  412. local function toggleAutoPlay(isEnabled)
  413. if isEnabled then
  414. local function autoPlay()
  415. wait(4)
  416. local args = {
  417. [1] = {
  418. [1] = {
  419. [1] = "\1"
  420. },
  421. [2] = "2"
  422. }
  423. }
  424. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
  425. end
  426.  
  427. if game.Players.LocalPlayer.Character then
  428. autoPlay()
  429. end
  430. game.Players.LocalPlayer.CharacterAdded:Connect(autoPlay)
  431. else
  432. for _, connection in pairs(getconnections(game.Players.LocalPlayer.CharacterAdded)) do
  433. if connection.Function and tostring(connection.Function):find("autoPlay") then
  434. connection:Disconnect()
  435. end
  436. end
  437. end
  438. end
  439.  
  440. -- Auto-Character Function
  441. local function toggleAutoCharacter(isEnabled)
  442. if isEnabled then
  443. local function autoCharacter()
  444. wait(7)
  445. local args = {
  446. [1] = {
  447. [1] = {
  448. [1] = "\1",
  449. [2] = {
  450. ["\3"] = "select",
  451. ["charact"] = 1
  452. }
  453. },
  454. [2] = "2"
  455. }
  456. }
  457. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(args))
  458. end
  459.  
  460. if game.Players.LocalPlayer.Character then
  461. autoCharacter()
  462. end
  463. game.Players.LocalPlayer.CharacterAdded:Connect(autoCharacter)
  464. else
  465. for _, connection in pairs(getconnections(game.Players.LocalPlayer.CharacterAdded)) do
  466. if connection.Function and tostring(connection.Function):find("autoCharacter") then
  467. connection:Disconnect()
  468. end
  469. end
  470. end
  471. end
  472.  
  473. -- Create toggle buttons
  474. createToggleButton(1, "Kill Aura", toggleKillAura)
  475. createToggleButton(2, "TP", toggleTP)
  476. createToggleButton(3, "Auto Ability", toggleAbility)
  477. createToggleButton(4, "Coin TP", toggleCoinTP)
  478. createToggleButton(5, "Auto Retry", toggleAutoRetry)
  479. createToggleButton(6, "Auto Play", toggleAutoPlay)
  480. createToggleButton(7, "Auto Character", toggleAutoCharacter)
  481.  
  482. -- Toggle GUI visibility
  483. CloseButton.MouseButton1Click:Connect(function()
  484. MainFrame.Visible = not MainFrame.Visible
  485. CloseButton.Text = MainFrame.Visible and "Close" or "Open"
  486. end)
  487.  
  488. gui = ScreenGui
  489. mainFrame = MainFrame
  490. closeButton = CloseButton
  491. end
  492.  
  493. -- Create the initial GUI
  494. createGui()
  495.  
  496. -- Recreate GUI when player rejoins
  497. game.Players.PlayerRemoving:Connect(function(plr)
  498. if plr == player then
  499. saveSettings(loadSettings())
  500. end
  501. end)
  502.  
  503. game.Players.PlayerAdded:Connect(function(plr)
  504. if plr == player then
  505. wait(1)
  506. createGui()
  507. end
  508. end)
  509.  
  510. -- Initialize
  511. local targetCoin = findNearestCoin()
  512. if not targetCoin then
  513. targetNPC = findNearestNPC()
  514. end
  515.  
  516. -- Main Heartbeat loop
  517. local lastTeleportTime = 0
  518. game:GetService("RunService").Heartbeat:Connect(function()
  519. if tpActive then
  520. stayOnTopOfTarget()
  521.  
  522. local currentTime = tick()
  523. if currentTime - lastTeleportTime >= delay then
  524. lastTeleportTime = currentTime
  525. targetCoin = findNearestCoin()
  526. if not targetCoin then
  527. targetNPC = findNearestNPC()
  528. end
  529. end
  530. end
  531.  
  532. -- Fire remote events based on GUI state
  533. local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
  534. local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
  535. local startButton = player.PlayerGui:WaitForChild("HUD"):WaitForChild("Mobile"):WaitForChild("StartButton")
  536.  
  537. if retryVote and retryVote.Enabled and autoRetryActive then
  538. local voteArgs = {
  539. [1] = {
  540. [1] = {
  541. ["\3"] = "vote",
  542. ["vote"] = true
  543. },
  544. [2] = "."
  545. }
  546. }
  547. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
  548. end
  549.  
  550. if revivePrompt and revivePrompt.Enabled and autoRetryActive then
  551. local reviveArgs = {
  552. [1] = {
  553. [1] = {
  554. ["\3"] = "closeRevive"
  555. },
  556. [2] = "\13"
  557. }
  558. }
  559. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
  560. end
  561.  
  562. -- Fire changeStartValue if StartButton is visible
  563. local function checkStartButton()
  564. local HUD = player.PlayerGui:WaitForChild("HUD", 10)
  565. if HUD then
  566. local Mobile = HUD:WaitForChild("Mobile", 5)
  567. if Mobile then
  568. local StartButton = Mobile:WaitForChild("StartButton", 2)
  569. if StartButton and StartButton.Visible then
  570. game:GetService("ReplicatedStorage").remotes.changeStartValue:FireServer()
  571. end
  572. end
  573. end
  574. end
  575.  
  576. -- Add this function to the main Heartbeat loop
  577. game:GetService("RunService").Heartbeat:Connect(function()
  578. if tpActive then
  579. stayOnTopOfTarget()
  580.  
  581. local currentTime = tick()
  582. if currentTime - lastTeleportTime >= delay then
  583. lastTeleportTime = currentTime
  584. targetCoin = findNearestCoin()
  585. if not targetCoin then
  586. targetNPC = findNearestNPC()
  587. end
  588. end
  589. end
  590.  
  591. -- Fire remote events based on GUI state
  592. local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
  593. local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
  594.  
  595. if retryVote and retryVote.Enabled and autoRetryActive then
  596. local voteArgs = {
  597. [1] = {
  598. [1] = {
  599. ["\3"] = "vote",
  600. ["vote"] = true
  601. },
  602. [2] = "."
  603. }
  604. }
  605. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
  606. end
  607.  
  608. if revivePrompt and revivePrompt.Enabled and autoRetryActive then
  609. local reviveArgs = {
  610. [1] = {
  611. [1] = {
  612. ["\3"] = "closeRevive"
  613. },
  614. [2] = "\13"
  615. }
  616. }
  617. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
  618. end
  619.  
  620. -- Check and fire changeStartValue if StartButton is visible
  621. checkStartButton()
  622. end)
  623. end
  624.  
  625. -- Create the initial GUI
  626. createGui()
  627.  
  628. -- Recreate GUI when player rejoins
  629. game.Players.PlayerRemoving:Connect(function(plr)
  630. if plr == player then
  631. saveSettings(loadSettings())
  632. end
  633. end)
  634.  
  635. game.Players.PlayerAdded:Connect(function(plr)
  636. if plr == player then
  637. wait(1)
  638. createGui()
  639. end
  640. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement