Forum > Scripts >

AutoFarmer For Any Game (Made By Me)

Posts: 10

Threads: 3

Joined: Dec, 2019

Reputation: 0

Posted

Copy And Paste The Script And Feel Free To Make Your Own Versions Based Off This

(Use Auto Clicker With It)

Can AutoRun, give speed and teleport between locations(some games have anti tp)

 

---Minis Pathfinding

PFS = game:GetService("PathfindingService")

Locations = {}

LocationCount = 0

testing = false

SpeedBoost = 400

 

--CreatePathFunction

function CreatePath(CharRadius,CharHeight,CanJump,StartPosition,EndPosition)

--Makes sure no arguments are missing

if CharRadius == nil then

local CharRadius = 2

end

if CharHeight == nil then

local CharHeight = 4

end

if CanJump == nil then

local CanJump = true

end

 

--Update Added this, has to be as a dictionary

local PathArguments = {

["AgentRadius"] = CharRadius,

["AgentHeight"] = CharHeight,

["AgentCanJump"] = CanJump}

 

local Path = PFS:CreatePath(PathArguments) --Creates Path Instance

Path:ComputeAsync(StartPosition,EndPosition)

 

--Check For Success

if Path.Status == Enum.PathStatus.Success then

local WayPoints = Path:GetWaypoints()

return WayPoints

else

return false

end

 

end

 

---Get Mouse

function GetControls()

if game.Players.LocalPlayer then

local Mouse = game.Players.LocalPlayer:GetMouse()

if testing == true then

print("Got Controls")

end

return Mouse

end

end

 

-- Get Player

function GetPlayer()

local Player = game.Players.LocalPlayer

if testing == true then

print("Got Player")

end

return Player

end

 

-- Get Char

function GetChar()

local Player = game.Players.LocalPlayer

local Char = Player.Character

return Char

end

 

-- Death Detection (Automatic)

game:GetService("Players").PlayerAdded:Connect(function(Player)

Player.CharacterAdded:Connect(function(Character)

local Humanoid = Character:FindFirstChild("Humanoid")

Humanoid.HealthChanged:Connect(function()

local Health = Humanoid.Health

if Health > 0 then

 

else

if ForceStop == false then

ForceStop = true

wait(5)

ForceStop = false

StartStop()

end

end

end)

end)

end)

 

 

-- Version 2 Of Controlling AutoFarn

--Current Features:

--Death Detection, Pathfinding, Setting Locations

function Keys()

local Mouse = GetControls()

Mouse.KeyDown:Connect(function(Key)

if Key == "=" then

ForceStop = false

StartStop()

end

if Key == "-" then

ForceStop = true

end

if Key == "[" then

AddLocation()

end

if Key == "]" then

ClearLocations()

end

if Key == "'" then

ForceStop = false

LocationTP()

end

if Key == "," then

local C = GetChar()

local H = C.Humanoid

H.Speed = SpeedBoost

 

end

end)

end

 

-- Movement Function

function StartStop()

while true do

-- Use ForceStop to stop movement

if ForceStop == true then

local Character = GetChar()

-- Moves To Current Position To Stop The Last MoveTo

Character.Humanoid:MoveTo(Character.HumanoidRootPart.Position)

ForceStop = false

break -- Stops the While true

else

-- Running And Active

for i = 1,#Locations do

-- Start Pathfinding To Locations

local CurrentLocation = Locations[i]

--Using Pathfinding

local C = GetChar()

local CP = C.HumanoidRootPart.Position

local WayPoints = CreatePath(2,4,true,CP,CurrentLocation)

 

-- Starts Moving On Path

if WayPoints == false then

-- No Path Could Be Created

else

 

for i2 = 1,#WayPoints do

-- Jump

if WayPoints[i2].Action == Enum.PathWaypointAction.Jump then

C.Humanoid.Jump = true

end

if ForceStop == true then

break -- stops the waypoint loop

else

-- Move Through WaypointLocations

local NextPostion = WayPoints[i2].Position

C.Humanoid:MoveTo(NextPostion)

--Waits For MoveTo To Finish

C.Humanoid.MoveToFinished:Wait()

end

end

end

end

end

end

end

 

-- AddLocation

function AddLocation()

local Char = GetChar()

local CharPosition = Char.HumanoidRootPart.Position

Locations[LocationCount] = CharPosition

LocationCount = LocationCount + 1

if testing == true then

print("Location Added")

end

end

 

-- ClearLocations

function ClearLocations()

LocationCount = 0

Locations = {}

if testing == true then

print("Locations Cleared")

end

end

 

--Teleport Between Locations

function LocationTP()

while true do

--Stops It running

if ForceStop == true then

break

else

for i = 1,#Locations do

local C = GetChar()

local Root = C.HumanoidRootPart

Root.CFrame = CFrame.new(Locations[i])

wait(1)

end

end

end

end

 

-- Testing V.2

wait(5)

print("Testing Version 2")

 

Keys()

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )