Advertisement
aesnike

MAIN AUTI

Oct 29th, 2024 (edited)
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.69 KB | None | 0 0
  1. -- Initialize variables at the top
  2. local player = game.Players.LocalPlayer
  3. local gui = nil
  4. local mainFrame = nil
  5. local closeButton = nil
  6. local coinStayDuration = 5
  7. local saveFilePath = "settings.txt"
  8.  
  9. -- Forward declare functions that are used before their definitions
  10. local createGui
  11. local makeDraggable
  12. local loadSettings
  13. local saveSettings
  14.  
  15. -- Function to safely get services and objects
  16. local function safeGet(parent, path)
  17. local current = parent
  18. for _, name in ipairs(path) do
  19. current = current and current:FindFirstChild(name)
  20. if not current then return nil end
  21. end
  22. return current
  23. end
  24.  
  25. -- Safely get remote events
  26. local dataRemoteEvent = safeGet(game:GetService("ReplicatedStorage"), {"dataRemoteEvent"})
  27. local changeStartValueRemote = safeGet(game:GetService("ReplicatedStorage"), {"remotes", "changeStartValue"})
  28.  
  29. -- Safely get GUI elements
  30. local retryVote = safeGet(player.PlayerGui, {"RetryVote"})
  31. local revivePrompt = safeGet(player.PlayerGui, {"RevivePrompt"})
  32. local startButton = safeGet(player.PlayerGui, {"HUD", "Mobile", "StartButton"})
  33.  
  34. local voteArgs = {
  35. [1] = {
  36. [1] = {
  37. ["\3"] = "vote",
  38. ["vote"] = true
  39. },
  40. [2] = "."
  41. }
  42. }
  43.  
  44. local reviveArgs = {
  45. [1] = {
  46. [1] = {
  47. ["\3"] = "closeRevive"
  48. },
  49. [2] = "\13"
  50. }
  51. }
  52.  
  53. -- Utility functions
  54. loadSettings = function()
  55. local success, data = pcall(function()
  56. return game:GetService("HttpService"):JSONDecode(readfile(saveFilePath))
  57. end)
  58. if success then
  59. return data
  60. else
  61. return {}
  62. end
  63. end
  64.  
  65. saveSettings = function(settings)
  66. pcall(function()
  67. writefile(saveFilePath, game:GetService("HttpService"):JSONEncode(settings))
  68. end)
  69. end
  70.  
  71. makeDraggable = function(object)
  72. local UserInputService = game:GetService("UserInputService")
  73. local dragging
  74. local dragInput
  75. local dragStart
  76. local startPos
  77.  
  78. local function update(input)
  79. local delta = input.Position - dragStart
  80. object.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  81. end
  82.  
  83. object.InputBegan:Connect(function(input)
  84. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  85. dragging = true
  86. dragStart = input.Position
  87. startPos = object.Position
  88.  
  89. input.Changed:Connect(function()
  90. if input.UserInputState == Enum.UserInputState.End then
  91. dragging = false
  92. end
  93. end)
  94. end
  95. end)
  96.  
  97. object.InputChanged:Connect(function(input)
  98. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  99. dragInput = input
  100. end
  101. end)
  102.  
  103. UserInputService.InputChanged:Connect(function(input)
  104. if input == dragInput and dragging then
  105. update(input)
  106. end
  107. end)
  108. end
  109.  
  110.  
  111. local function findNearestNPC()
  112. local nearestNPC = nil
  113. local nearestDistance = math.huge
  114.  
  115. local Character = player.Character
  116. if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
  117.  
  118. local dungeon = workspace:FindFirstChild("dungeon")
  119. if not dungeon then return end
  120.  
  121. for _, child in ipairs(dungeon:GetChildren()) do
  122. if child:FindFirstChild("enemyFolder") then
  123. for _, npc in ipairs(child.enemyFolder:GetChildren()) do
  124. if npc:FindFirstChild("HumanoidRootPart") and npc:FindFirstChild("Humanoid") and npc.Humanoid.Health > 0 then
  125. local distance = (Character.HumanoidRootPart.Position - npc.HumanoidRootPart.Position).Magnitude
  126. if distance < nearestDistance then
  127. nearestDistance = distance
  128. nearestNPC = npc
  129. end
  130. end
  131. end
  132. end
  133. end
  134. return nearestNPC
  135. end
  136.  
  137. local function softLockCharacter(character, position)
  138. if character and character:FindFirstChild("HumanoidRootPart") then
  139. local connection
  140. connection = game:GetService("RunService").Heartbeat:Connect(function()
  141. if character.Parent and character:FindFirstChild("HumanoidRootPart") then
  142. character.HumanoidRootPart.CFrame = position
  143. else
  144. connection:Disconnect()
  145. end
  146. end)
  147. return connection
  148. end
  149. end
  150.  
  151. local softLockConnection
  152. local tpActive = false
  153.  
  154. local function teleportToNPC()
  155. if not tpActive then return end
  156.  
  157. local Character = player.Character
  158. if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
  159.  
  160. local npc = findNearestNPC()
  161. if npc and npc:FindFirstChild("HumanoidRootPart") then
  162. local npcPosition = npc.HumanoidRootPart.Position
  163. local teleportPosition = Vector3.new(npcPosition.X, npcPosition.Y + 9, npcPosition.Z)
  164.  
  165. local lookVector = (npcPosition - teleportPosition).Unit
  166. local lookCFrame = CFrame.new(teleportPosition, teleportPosition + lookVector)
  167.  
  168. Character.HumanoidRootPart.CFrame = lookCFrame
  169.  
  170. if softLockConnection then
  171. softLockConnection:Disconnect()
  172. end
  173.  
  174. softLockConnection = softLockCharacter(Character, lookCFrame)
  175. end
  176. end
  177.  
  178. local function mainLoop()
  179. while true do
  180. teleportToNPC()
  181. task.wait(2)
  182. end
  183. end
  184.  
  185. local function setupCharacter(character)
  186. character:WaitForChild("HumanoidRootPart")
  187. coroutine.wrap(mainLoop)()
  188. end
  189.  
  190. if player.Character then
  191. setupCharacter(player.Character)
  192. end
  193.  
  194. player.CharacterAdded:Connect(setupCharacter)
  195.  
  196. local killAuraActive = false
  197. local killAuraLoop = nil
  198. local function toggleKillAura(isEnabled)
  199. killAuraActive = isEnabled
  200. if isEnabled then
  201. if not killAuraLoop then
  202. killAuraLoop = spawn(function()
  203. while killAuraActive do
  204. local args = {
  205. [1] = {
  206. [1] = {
  207. ["animationLength"] = 0,
  208. ["sentAt"] = tick()
  209. },
  210. [2] = "N"
  211. }
  212. }
  213. if dataRemoteEvent then
  214. dataRemoteEvent:FireServer(unpack(args))
  215. end
  216. task.wait()
  217. end
  218. end)
  219. end
  220. else
  221. killAuraActive = false
  222. killAuraLoop = nil
  223. end
  224. end
  225.  
  226. local abilityActive = false
  227. local abilityLoop = nil
  228. local function toggleAbility(isEnabled)
  229. abilityActive = isEnabled
  230. if isEnabled then
  231. if not abilityLoop then
  232. abilityLoop = spawn(function()
  233. local VirtualInputManager = game:GetService("VirtualInputManager")
  234. local lastKeyPress = 0
  235. local keyPressCooldown = 0.2
  236.  
  237. while abilityActive do
  238. local Character = player.Character
  239. if Character and Character:FindFirstChild("HumanoidRootPart") then
  240. local function isNearMobs(range)
  241. for _, folder in ipairs(workspace:GetChildren()) do
  242. if folder:IsA("Folder") then
  243. for _, child in ipairs(folder:GetChildren()) do
  244. if child:FindFirstChild("enemyFolder") then
  245. for _, npc in ipairs(child.enemyFolder:GetChildren()) do
  246. if npc:FindFirstChild("HumanoidRootPart") and npc:FindFirstChild("Humanoid") and npc.Humanoid.Health > 0 then
  247. local distance = (Character.HumanoidRootPart.Position - npc.HumanoidRootPart.Position).Magnitude
  248. if distance <= range then
  249. return true
  250. end
  251. end
  252. end
  253. end
  254. end
  255. end
  256. end
  257. return false
  258. end
  259.  
  260. if isNearMobs(20) and tick() - lastKeyPress >= keyPressCooldown then
  261. VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.E, false, nil)
  262. task.wait()
  263. VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.E, false, nil)
  264.  
  265. VirtualInputManager:SendKeyEvent(true, Enum.KeyCode.Q, false, nil)
  266. task.wait()
  267. VirtualInputManager:SendKeyEvent(false, Enum.KeyCode.Q, false, nil)
  268.  
  269. lastKeyPress = tick()
  270. end
  271. end
  272. wait(0.1)
  273. end
  274. end)
  275. end
  276. else
  277. abilityActive = false
  278. abilityLoop = nil
  279. end
  280. end
  281.  
  282. local coinTPActive = false
  283. local coinTPLoop = nil
  284.  
  285. local function findNearestCoin()
  286. local nearestCoin = nil
  287. local nearestDistance = math.huge
  288.  
  289. local Character = player.Character
  290. if not Character or not Character:FindFirstChild("HumanoidRootPart") then return end
  291.  
  292. for _, descendant in ipairs(workspace:GetDescendants()) do
  293. if descendant.Name == "Coin" and descendant:IsA("BasePart") then
  294. local distance = (Character.HumanoidRootPart.Position - descendant.Position).Magnitude
  295. if distance < nearestDistance then
  296. nearestDistance = distance
  297. nearestCoin = descendant
  298. end
  299. end
  300. end
  301. return nearestCoin
  302. end
  303.  
  304. local function toggleCoinTP(isEnabled)
  305. coinTPActive = isEnabled
  306. if isEnabled then
  307. if not coinTPLoop then
  308. coinTPLoop = spawn(function()
  309. while coinTPActive do
  310. local coin = findNearestCoin()
  311. if coin and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
  312. local offset = Vector3.new(0, 3, 0)
  313. player.Character.HumanoidRootPart.CFrame = CFrame.new(coin.Position + offset)
  314. wait(coinStayDuration) -- Use the coinStayDuration here
  315. else
  316. wait(0.5)
  317. end
  318. end
  319. end)
  320. end
  321. else
  322. coinTPActive = false
  323. if coinTPLoop then
  324. coinTPLoop:Disconnect()
  325. coinTPLoop = nil
  326. end
  327. end
  328. end
  329.  
  330. local autoRetryActive = false
  331. local autoRetryLoop = nil
  332.  
  333. local function toggleAutoRetry(isEnabled)
  334. autoRetryActive = isEnabled
  335. if isEnabled then
  336. if not autoRetryLoop then
  337. autoRetryLoop = spawn(function()
  338. while autoRetryActive do
  339. local function checkForEndScreen()
  340. local retryVote = player.PlayerGui:FindFirstChild("RetryVote")
  341. local revivePrompt = player.PlayerGui:FindFirstChild("RevivePrompt")
  342.  
  343. if retryVote and retryVote.Enabled then
  344. wait(1)
  345. local voteArgs = {
  346. [1] = {
  347. [1] = {
  348. ["\3"] = "vote",
  349. ["vote"] = true
  350. },
  351. [2] = "."
  352. }
  353. }
  354. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(voteArgs))
  355. elseif revivePrompt and revivePrompt.Enabled then
  356. wait(1)
  357. local reviveArgs = {
  358. [1] = {
  359. [1] = {
  360. ["\3"] = "closeRevive"
  361. },
  362. [2] = "\13"
  363. }
  364. }
  365. game:GetService("ReplicatedStorage").dataRemoteEvent:FireServer(unpack(reviveArgs))
  366. end
  367.  
  368. -- Auto Start
  369. local startButton = player.PlayerGui:FindFirstChild("HUD"):FindFirstChild("Mobile"):FindFirstChild("StartButton")
  370. if startButton and startButton.Visible then
  371. wait(1)
  372. game:GetService("ReplicatedStorage").remotes.changeStartValue:FireServer(true)
  373. end
  374. end
  375.  
  376. checkForEndScreen()
  377. wait(1) -- Wait for 1 second before checking again
  378. end
  379. end)
  380. end
  381. else
  382. autoRetryActive = false
  383. if autoRetryLoop then
  384. autoRetryLoop:Disconnect()
  385. autoRetryLoop = nil
  386. end
  387. end
  388. end
  389.  
  390. local function createGui()
  391. if gui then
  392. gui:Destroy()
  393. end
  394.  
  395. local ScreenGui = Instance.new("ScreenGui")
  396. local MainFrame = Instance.new("Frame")
  397. local ImageLabel = Instance.new("ImageLabel")
  398. local CloseButton = Instance.new("TextButton")
  399. local ButtonContainer = Instance.new("Frame")
  400. local HeaderLabel = Instance.new("TextLabel")
  401.  
  402. -- ScreenGui setup
  403. ScreenGui.Name = "PersistentGUI"
  404. ScreenGui.ResetOnSpawn = false
  405. ScreenGui.DisplayOrder = 999999999
  406. ScreenGui.Parent = game.Players.LocalPlayer.PlayerGui
  407.  
  408. -- CloseButton setup
  409. CloseButton.Size = UDim2.new(0, 150, 0, 45)
  410. CloseButton.Position = UDim2.new(0.5, -75, 0, -40) -- Changed to center horizontally and moved higher
  411. CloseButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  412. CloseButton.BackgroundTransparency = 0.3
  413. CloseButton.Text = "Open/Close"
  414. CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  415. CloseButton.Font = Enum.Font.GothamBlack
  416. CloseButton.TextSize = 16
  417. CloseButton.Parent = ScreenGui
  418. CloseButton.ZIndex = 10
  419.  
  420. -- Add corner to close button
  421. local closeCorner = Instance.new("UICorner")
  422. closeCorner.CornerRadius = UDim.new(0.3, 0)
  423. closeCorner.Parent = CloseButton
  424.  
  425. -- Add stroke to close button
  426. local closeStroke = Instance.new("UIStroke")
  427. closeStroke.Color = Color3.fromRGB(255, 255, 255)
  428. closeStroke.Transparency = 0.8
  429. closeStroke.Thickness = 1
  430. closeStroke.Parent = CloseButton
  431.  
  432. -- MainFrame setup
  433. MainFrame.Size = UDim2.new(0.25, 0, 0.6, 0)
  434. MainFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
  435. MainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  436. MainFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  437. MainFrame.BackgroundTransparency = 0.5
  438. MainFrame.BorderSizePixel = 0
  439. MainFrame.ClipsDescendants = true
  440. MainFrame.Visible = true
  441. MainFrame.ZIndex = 1
  442. MainFrame.Parent = ScreenGui
  443.  
  444. -- Image setup
  445. ImageLabel.Size = UDim2.new(1, 0, 0.6, 0)
  446. ImageLabel.Position = UDim2.new(0, 0, 0, 0)
  447. ImageLabel.BackgroundTransparency = 1
  448. ImageLabel.Image = "rbxassetid://83971645462159"
  449. ImageLabel.ScaleType = Enum.ScaleType.Fit
  450. ImageLabel.ZIndex = 2
  451. ImageLabel.Parent = MainFrame
  452.  
  453. -- Header setup
  454. HeaderLabel.Size = UDim2.new(1, 0, 0.1, 0)
  455. HeaderLabel.Position = UDim2.new(0, 0, 0, 0)
  456. HeaderLabel.BackgroundTransparency = 1
  457. HeaderLabel.Text = "Kinayo Ripoff"
  458. HeaderLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  459. HeaderLabel.Font = Enum.Font.GothamBold
  460. HeaderLabel.TextSize = 24
  461. HeaderLabel.ZIndex = 3
  462. HeaderLabel.Parent = MainFrame
  463.  
  464. -- Button Container setup
  465. ButtonContainer.Size = UDim2.new(1, 0, 0.45, 0)
  466. ButtonContainer.Position = UDim2.new(0, 0, 1, 0)
  467. ButtonContainer.AnchorPoint = Vector2.new(0, 1)
  468. ButtonContainer.BackgroundTransparency = 1
  469. ButtonContainer.Parent = MainFrame
  470.  
  471. local mainFrameCorner = Instance.new("UICorner")
  472. mainFrameCorner.CornerRadius = UDim.new(0.05, 0)
  473. mainFrameCorner.Parent = MainFrame
  474.  
  475. -- Grid layout for buttons
  476. local UIGridLayout = Instance.new("UIGridLayout")
  477. UIGridLayout.Parent = ButtonContainer
  478. UIGridLayout.CellSize = UDim2.new(0.48, -1, 0.18, 0)
  479. UIGridLayout.CellPadding = UDim2.new(0, 2, 0, 2)
  480. UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
  481. UIGridLayout.FillDirectionMaxCells = 2
  482. UIGridLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  483. UIGridLayout.VerticalAlignment = Enum.VerticalAlignment.Bottom
  484.  
  485. -- Make frames draggable
  486. makeDraggable(CloseButton)
  487. makeDraggable(MainFrame)
  488.  
  489. local savedSettings = loadSettings()
  490.  
  491. local function createToggleButton(number, name, onClick)
  492. local button = Instance.new("TextButton")
  493. button.Size = UDim2.new(1, 0, 1, 0)
  494. button.BackgroundTransparency = 0.1 -- Reduced from 0.3 to make it more white
  495. button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  496. button.Text = name
  497. button.TextColor3 = Color3.fromRGB(0, 0, 0)
  498. button.Font = Enum.Font.GothamBlack
  499. button.TextSize = 14
  500. button.LayoutOrder = number
  501. button.Parent = ButtonContainer
  502. button.ZIndex = 2
  503.  
  504. -- Add rounder corners to button
  505. local corner = Instance.new("UICorner")
  506. corner.CornerRadius = UDim.new(0.3, 0)
  507. corner.Parent = button
  508.  
  509. -- Add stroke to button
  510. local stroke = Instance.new("UIStroke")
  511. stroke.Color = Color3.fromRGB(255, 255, 255)
  512. stroke.Transparency = 0.9
  513. stroke.Thickness = 1
  514. stroke.Parent = button
  515.  
  516. local isEnabled = savedSettings[name] or false
  517.  
  518. local function updateButtonAppearance()
  519. if isEnabled then
  520. button.BackgroundColor3 = Color3.fromRGB(86, 71, 201)
  521. button.TextColor3 = Color3.fromRGB(255, 255, 255)
  522. stroke.Transparency = 0.7
  523. else
  524. button.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  525. button.TextColor3 = Color3.fromRGB(0, 0, 0)
  526. stroke.Transparency = 0.9
  527. end
  528. end
  529.  
  530. updateButtonAppearance()
  531.  
  532. if isEnabled then
  533. onClick(true)
  534. end
  535.  
  536. button.MouseButton1Click:Connect(function()
  537. isEnabled = not isEnabled
  538. updateButtonAppearance()
  539. onClick(isEnabled)
  540. savedSettings[name] = isEnabled
  541. saveSettings(savedSettings)
  542. end)
  543. end
  544.  
  545. createToggleButton(1, "TP Mob", function(enabled) tpActive = enabled end)
  546. createToggleButton(2, "Kill Aura", toggleKillAura)
  547. createToggleButton(3, "Auto Ability", toggleAbility)
  548. createToggleButton(4, "Coin TP", toggleCoinTP)
  549. createToggleButton(5, "Auto Retry-Start", toggleAutoRetry)
  550.  
  551. CloseButton.MouseButton1Click:Connect(function()
  552. MainFrame.Visible = not MainFrame.Visible
  553. end)
  554.  
  555. gui = ScreenGui
  556. mainFrame = MainFrame
  557. closeButton = CloseButton
  558.  
  559. return ScreenGui, MainFrame, CloseButton
  560. end
  561.  
  562. -- Initialize the GUI
  563. createGui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement