AutumnMoon88683

auto sword

Jan 15th, 2025 (edited)
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.98 KB | None | 0 0
  1. -- Gui to Lua
  2. -- Version: 3.2
  3.  
  4. -- Instances:
  5.  
  6. local AutoSwordByZaya = Instance.new("ScreenGui")
  7. local Frame = Instance.new("Frame")
  8. local UICorner = Instance.new("UICorner")
  9. local TopBar = Instance.new("Frame")
  10. local Exit = Instance.new("TextButton")
  11. local SearchDistance = Instance.new("TextBox")
  12. local InfoText = Instance.new("TextLabel")
  13. local WanderDistance = Instance.new("TextBox")
  14. local SelectTool = Instance.new("TextButton")
  15. local StartStopButton = Instance.new("TextButton")
  16.  
  17. --Properties:
  18.  
  19. AutoSwordByZaya.Name = "AutoSwordByZaya"
  20.  
  21. if game:GetService("CoreGui"):FindFirstChild("AutoSwordByZaya") then
  22.     game:GetService("CoreGui"):FindFirstChild("AutoSwordByZaya"):Destroy()
  23. end
  24.  
  25. AutoSwordByZaya.Parent = game:GetService("CoreGui")
  26.  
  27. Frame.Parent = AutoSwordByZaya
  28. Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  29. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  30. Frame.BorderSizePixel = 0
  31. Frame.Position = UDim2.new(0, 0, 0.406398118, 0)
  32. Frame.Size = UDim2.new(0, 137, 0, 176)
  33.  
  34. UICorner.Parent = Frame
  35.  
  36. TopBar.Name = "TopBar"
  37. TopBar.Parent = Frame
  38. TopBar.BackgroundColor3 = Color3.fromRGB(71, 135, 255)
  39. TopBar.BorderColor3 = Color3.fromRGB(0, 0, 0)
  40. TopBar.BorderSizePixel = 0
  41. TopBar.Position = UDim2.new(0, 0, -0.0340909101, 0)
  42. TopBar.Size = UDim2.new(0, 137, 0, 20)
  43.  
  44. Exit.Name = "Exit"
  45. Exit.Parent = TopBar
  46. Exit.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  47. Exit.BorderColor3 = Color3.fromRGB(0, 0, 0)
  48. Exit.BorderSizePixel = 0
  49. Exit.Position = UDim2.new(0.963503659, -15, 0, 0)
  50. Exit.Size = UDim2.new(0, 20, 0, 20)
  51. Exit.Font = Enum.Font.SourceSans
  52. Exit.Text = "X"
  53. Exit.TextColor3 = Color3.fromRGB(0, 0, 0)
  54. Exit.TextScaled = true
  55. Exit.TextSize = 14.000
  56. Exit.TextWrapped = true
  57.  
  58. SearchDistance.Name = "SearchDistance"
  59. SearchDistance.Parent = Frame
  60. SearchDistance.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  61. SearchDistance.BackgroundTransparency = 0.950
  62. SearchDistance.BorderColor3 = Color3.fromRGB(0, 0, 0)
  63. SearchDistance.BorderSizePixel = 0
  64. SearchDistance.Position = UDim2.new(0, 0, 0.331618905, 0)
  65. SearchDistance.Size = UDim2.new(0, 137, 0, 19)
  66. SearchDistance.Font = Enum.Font.SourceSans
  67. SearchDistance.PlaceholderText = "Search Distance"
  68. SearchDistance.Text = "100"
  69. SearchDistance.TextColor3 = Color3.fromRGB(0, 0, 0)
  70. SearchDistance.TextScaled = true
  71. SearchDistance.TextSize = 14.000
  72. SearchDistance.TextWrapped = true
  73.  
  74. InfoText.Name = "InfoText"
  75. InfoText.Parent = Frame
  76. InfoText.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  77. InfoText.BorderColor3 = Color3.fromRGB(0, 0, 0)
  78. InfoText.BorderSizePixel = 0
  79. InfoText.Position = UDim2.new(0, 0, 0.0795454532, 0)
  80. InfoText.Size = UDim2.new(0, 137, 0, 36)
  81. InfoText.Font = Enum.Font.Gotham
  82. InfoText.TextColor3 = Color3.fromRGB(0, 0, 0)
  83. InfoText.TextScaled = true
  84. InfoText.TextSize = 14.000
  85. InfoText.TextWrapped = true
  86. InfoText.Text = "Start by holding a tool and pressing 'SelectTool'"
  87.  
  88. WanderDistance.Name = "WanderDistance"
  89. WanderDistance.Parent = Frame
  90. WanderDistance.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  91. WanderDistance.BackgroundTransparency = 0.950
  92. WanderDistance.BorderColor3 = Color3.fromRGB(0, 0, 0)
  93. WanderDistance.BorderSizePixel = 0
  94. WanderDistance.Position = UDim2.new(0, 0, 0.439573467, 0)
  95. WanderDistance.Size = UDim2.new(0, 137, 0, 19)
  96. WanderDistance.Font = Enum.Font.SourceSans
  97. WanderDistance.PlaceholderText = "Wander Distance"
  98. WanderDistance.Text = "15"
  99. WanderDistance.TextColor3 = Color3.fromRGB(0, 0, 0)
  100. WanderDistance.TextScaled = true
  101. WanderDistance.TextSize = 14.000
  102. WanderDistance.TextWrapped = true
  103.  
  104. SelectTool.Name = "SelectTool"
  105. SelectTool.Parent = Frame
  106. SelectTool.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  107. SelectTool.BorderColor3 = Color3.fromRGB(0, 0, 0)
  108. SelectTool.BorderSizePixel = 0
  109. SelectTool.Position = UDim2.new(0, 0, 0.835065663, 0)
  110. SelectTool.Size = UDim2.new(0.5, 0, 0.0456161499, 21)
  111. SelectTool.Style = Enum.ButtonStyle.RobloxRoundDefaultButton
  112. SelectTool.Font = Enum.Font.Gotham
  113. SelectTool.Text = "SelectTool"
  114. SelectTool.TextColor3 = Color3.fromRGB(0, 0, 0)
  115. SelectTool.TextSize = 13.000
  116.  
  117. StartStopButton.Name = "StartStopButton"
  118. StartStopButton.Parent = Frame
  119. StartStopButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  120. StartStopButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
  121. StartStopButton.BorderSizePixel = 0
  122. StartStopButton.Position = UDim2.new(0.496350378, 0, 0.835065663, 0)
  123. StartStopButton.Size = UDim2.new(0.5, 0, 0.0456161499, 21)
  124. StartStopButton.Style = Enum.ButtonStyle.RobloxRoundDefaultButton
  125. StartStopButton.Font = Enum.Font.Gotham
  126. StartStopButton.Text = "Start"
  127. StartStopButton.TextColor3 = Color3.fromRGB(0, 0, 0)
  128. StartStopButton.TextSize = 25.000
  129.  
  130. -- Scripts:
  131.  
  132. local function REVV_fake_script() -- Frame.Functions
  133.     local script = Instance.new('LocalScript', Frame)
  134.  
  135.     local plr = game.Players.LocalPlayer
  136.    
  137.     local char = plr.Character or plr.CharacterAdded:Wait()
  138.    
  139.     local hum = char:FindFirstChildWhichIsA("Humanoid")
  140.    
  141.     local rootpart:BasePart = char.PrimaryPart or char:FindFirstChild("HumanoidRootPart") or hum.RootPart
  142.    
  143.     local SearchDist = script.Parent:WaitForChild("SearchDistance")
  144.    
  145.     local WanderDist = script.Parent:WaitForChild("WanderDistance")
  146.    
  147.     local SelectTool = script.Parent:WaitForChild("SelectTool")
  148.    
  149.     local startstop = script.Parent:WaitForChild("StartStopButton")
  150.    
  151.     local label = script.Parent:WaitForChild("InfoText")
  152.    
  153.     local on = false
  154.    
  155.     local tool:Tool = nil
  156.    
  157.     local target = nil
  158.    
  159.     local targethum = nil
  160.    
  161.     local wandercooldown = false
  162.    
  163.     local teleport = false
  164.    
  165.     local off = {0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,2,3}
  166.    
  167.     local function GetNearestRoot()
  168.         local nearestRoot = nil
  169.         local nearestDistance = nil
  170.         for i,v in pairs(game.Players:GetPlayers()) do
  171.             if v.Character and v.Character:FindFirstChild("HumanoidRootPart") and v.Character.Humanoid.Health > 1 and v.Name ~= plr.Name then
  172.                 local distance = (v.Character.HumanoidRootPart.Position - rootpart.Position).Magnitude
  173.                 local numm = tonumber(SearchDist.Text or 15)
  174.                 if distance <= numm then
  175.                     nearestDistance = distance
  176.                     nearestRoot = v.Character.HumanoidRootPart
  177.                     targethum = v.Character:FindFirstChildWhichIsA("Humanoid")
  178.                     target = v.Character
  179.                 end
  180.             end
  181.         end
  182.         return nearestRoot
  183.     end
  184.    
  185.     local function EquipTool()
  186.         if tool then
  187.             hum:EquipTool(tool)
  188.         end
  189.     end
  190.    
  191.     local function UnequipTool()
  192.         if char:FindFirstChildWhichIsA("Tool") then
  193.             if char:FindFirstChildWhichIsA("Tool").Name == tool.Name then
  194.                 hum:UnequipTools()
  195.             end
  196.         end
  197.     end
  198.    
  199.     local function CheckIfTargetIsDead()
  200.         if not target then return end
  201.         if target and targethum.Health <= 0 then
  202.             return true
  203.         end
  204.         return false
  205.     end
  206.    
  207.     local function Jump()
  208.         hum.Jump = true
  209.     end
  210.    
  211.     local alignOrientation1 = nil
  212.    
  213.     if not rootpart:FindFirstChild("ZALign") then
  214.         local alignOrientation = Instance.new("AlignOrientation")
  215.         alignOrientation.Parent = rootpart
  216.         alignOrientation.Name = "ZALign"
  217.         alignOrientation.MaxAngularVelocity = math.rad(2000)
  218.         alignOrientation1 = alignOrientation
  219.         local attachment = Instance.new("Attachment")
  220.         attachment.Parent = rootpart
  221.         attachment.Name = "AlignRotationRootPart"
  222.         alignOrientation.Attachment0 = attachment
  223.     else   
  224.         local alignOrientation = rootpart:FindFirstChild("ZALign")
  225.         alignOrientation1 = alignOrientation
  226.         alignOrientation.MaxAngularVelocity = math.rad(2000)
  227.         if not rootpart:FindFirstChild("AlignRotationRootPart") then
  228.             local attachment = Instance.new("Attachment")
  229.             attachment.Parent = rootpart
  230.             attachment.Name = "AlignRotationRootPart"
  231.             alignOrientation.Attachment0 = attachment
  232.         else   
  233.             local attachment = rootpart:FindFirstChild("AlignRotationRootPart")
  234.             alignOrientation.Attachment0 = attachment
  235.         end
  236.     end
  237.    
  238.  
  239.    
  240.     local function updateOrientation()
  241.         if target then
  242.             alignOrientation1.Enabled = true
  243.             local lookAtCFrame = CFrame.lookAt(rootpart.Position, target.PrimaryPart.Position+Vector3.new(0,off[math.random(1,#off)],0))
  244.             alignOrientation1.CFrame = lookAtCFrame
  245.         else   
  246.             alignOrientation1.Enabled = false
  247.         end
  248.     end
  249.    
  250.     function MoveToTarget(char, targetPart)
  251.        
  252.         local PathfindingService = game:GetService("PathfindingService")
  253.         local humanoid = char:WaitForChild("Humanoid")
  254.         local humanRootPart = char.PrimaryPart or char:FindFirstChild("HumanoidRootPart") or humanoid.RootPart or char:FindFirstChild("Head")
  255.    
  256.         local path = PathfindingService:CreatePath({
  257.             AgentRadius = 2,
  258.             AgentHeight = 5,
  259.             AgentCanJump = true,
  260.             AgentJumpHeight = 10,
  261.             AgentMaxSlope = 45,
  262.         })
  263.        
  264.         -- Compute the path to the target
  265.         path:ComputeAsync(humanRootPart.Position, targetPart.CFrame.Position + targetPart.CFrame.LookVector +Vector3.new(off[math.random(1,#off)],-10,off[math.random(1,#off)])
  266.         )
  267.         local waypoints = path:GetWaypoints()
  268.    
  269.         -- Function to handle reaching waypoints
  270.         local function onWaypointReached(waypointIndex)
  271.             if waypointIndex < #waypoints then
  272.                 if waypoints[waypointIndex + 1].Action == Enum.PathWaypointAction.Jump then
  273.                     humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  274.                 end
  275.                 humanoid:MoveTo(waypoints[waypointIndex + 1].Position)
  276.             end
  277.         end
  278.        
  279.         path.Blocked:Connect(Jump)
  280.         if math.random(1,10) > 9 then
  281.             hum.Jump = true
  282.         end
  283.         -- Connect an event to Humanoid's MoveToFinished event
  284.         humanoid.MoveToFinished:Connect(function(reached)
  285.             if reached then
  286.                 onWaypointReached(#waypoints)
  287.             end
  288.         end)
  289.    
  290.         -- Start moving to the first waypoint
  291.         if #waypoints > 0 then
  292.             humanoid:MoveTo(waypoints[1].Position)
  293.             for i = 1, #waypoints - 1 do
  294.                 onWaypointReached(i)
  295.             end
  296.         end
  297.     end
  298.    
  299.     local function KeepClickingUntilNoTool()
  300.         coroutine.resume(coroutine.create(function()
  301.             repeat
  302.                 if char:FindFirstChildWhichIsA("Tool") then
  303.                     if char:FindFirstChildWhichIsA("Tool").Name == tool.Name then
  304.                         tool:Activate()
  305.                         --mouse1click()
  306.                     end
  307.                 end
  308.                 task.wait(0.75)
  309.             until
  310.             not tool or tool == nil or hum.Health <= 0 or targethum == nil or target == nil
  311.         end))
  312.     end
  313.    
  314.     local function EquipToolIfTargetIsNear()
  315.         if CheckIfTargetIsDead() == true then return end
  316.         if (target.PrimaryPart.Position - rootpart.Position).Magnitude <= 5 then
  317.             if not char:FindFirstChildWhichIsA("Tool") then
  318.                 EquipTool()
  319.             end
  320.             KeepClickingUntilNoTool()
  321.         end
  322.     end
  323.    
  324.     local function Wander()
  325.         if wandercooldown ~= false then return end
  326.         wandercooldown = true
  327.        
  328.         task.wait(math.random(1,7))
  329.         wandercooldown = false
  330.     end
  331.    
  332.     local function Teleport(targetroot)
  333.         char:MoveTo(targetroot.Position)
  334.     end
  335.    
  336.     local function Main()
  337.         if GetNearestRoot() ~= nil then
  338.             hum.Sit = false
  339.             EquipToolIfTargetIsNear()
  340.             updateOrientation()
  341.             if teleport then
  342.                 Teleport(GetNearestRoot())
  343.             else   
  344.                 MoveToTarget(char, GetNearestRoot())
  345.             end
  346.         else   
  347.             Wander()
  348.         end
  349.     end
  350.    
  351.     local function SetLabel()
  352.         if tool ~= nil then
  353.             if on ~= false then
  354.                 label.Text = "Tool: "..tool.Name.." \n".."Enabled: true"
  355.             else   
  356.                 label.Text = "Tool: "..tool.Name.." \n".."Enabled: false"
  357.             end
  358.         else   
  359.             if on ~= false then
  360.                 label.Text = "Tool: nil \n".."Enabled: true"
  361.             else   
  362.                 label.Text = "Tool: nil \n".."Enabled: false"
  363.             end
  364.         end
  365.     end
  366.    
  367.     SelectTool.Activated:Connect(function()
  368.         if char:FindFirstChildWhichIsA("Tool") then
  369.             tool = char:FindFirstChildWhichIsA("Tool")
  370.         end
  371.     end)
  372.    
  373.     startstop.Activated:Connect(function()
  374.         on = not on
  375.     end)
  376.    
  377.     hum.Died:Connect(function()
  378.         plr.CharacterAdded:Connect(function()
  379.             loadstring(game:HttpGet(('https://pastebin.com/raw/kXnhWMwc'),true))()
  380.         end)
  381.     end)
  382.    
  383.     while true do
  384.         task.wait()
  385.         SetLabel()
  386.         if on ~= false then
  387.             Main()
  388.         end
  389.     end
  390.    
  391. end
  392. coroutine.wrap(REVV_fake_script)()
  393. local function WDEWP_fake_script() -- Frame.UIDrag
  394.     local script = Instance.new('LocalScript', Frame)
  395.  
  396.     -- Made by Real_IceyDev (@lceyDex) --
  397.     -- Simple UI dragger (PC Only/Any device that has a mouse) --
  398.    
  399.     local UIS = game:GetService('UserInputService')
  400.     local frame = script.Parent
  401.     local dragToggle = nil
  402.     local dragSpeed = 0.25
  403.     local dragStart = nil
  404.     local startPos = nil
  405.    
  406.     local function updateInput(input)
  407.         local delta = input.Position - dragStart
  408.         local position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
  409.             startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  410.         game:GetService('TweenService'):Create(frame, TweenInfo.new(dragSpeed), {Position = position}):Play()
  411.     end
  412.    
  413.     frame.InputBegan:Connect(function(input)
  414.         if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  415.             dragToggle = true
  416.             dragStart = input.Position
  417.             startPos = frame.Position
  418.             input.Changed:Connect(function()
  419.                 if input.UserInputState == Enum.UserInputState.End then
  420.                     dragToggle = false
  421.                 end
  422.             end)
  423.         end
  424.     end)
  425.    
  426.     UIS.InputChanged:Connect(function(input)
  427.         if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  428.             if dragToggle then
  429.                 updateInput(input)
  430.             end
  431.         end
  432.     end)
  433. end
  434. coroutine.wrap(WDEWP_fake_script)()
  435.  
Tags: swords
Add Comment
Please, Sign In to add comment