EdvinNikolay

Untitled

Oct 5th, 2019
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. --[[
  2. Fully automatic money/miles farm
  3. TODO:
  4. Add auto respawn vehicle
  5. ]]
  6. local waitTime = 3 --This will be the time it takes (seconds) until your car resets. See line 37
  7. --Do not change anything below :)
  8. local hint = Instance.new('Hint', Workspace) hint.Text = "Vehicle Simulator Autofarm loading..."
  9. local found = false
  10. local go = true
  11.  
  12. function findVehicle() --Finds your vehicle
  13. while not found do --Loops until your vehicle has been found
  14. local vehicles = Workspace.Vehicles:getChildren()
  15. for i=1,#vehicles do
  16. if vehicles[i]:findFirstChild'owner' then
  17. if vehicles[i].owner.Value == game:GetService'Players'.LocalPlayer.Name then -- Found your vehicle
  18. found = true --Setting found to true so loop breaks
  19. vehicle = vehicles[i] -- Declares vehicle variable to your vehicle
  20. vehStats = vehicle.Handling -- Declares vehStats variable to vehicle stats folder
  21. vehStats.MaxSpeed.Value = 700
  22. vehStats.Torque.Value = 30000
  23. vehStats.SteeringRadiusConstant.Value = 120000000
  24. elseif vehicles[i + 1] == nil and not found then
  25. --Autorespawn would go here
  26. hint.Text = "Please spawn and enter your vehicle!" --Your vehicle does not exist in the Workspace
  27. end
  28. end
  29. end
  30. wait(1) --Waiting before checking again so we don't crash
  31. end
  32. wait(2) --We've found the car. Waiting so the car can be properly placed on the highway
  33. vehicle.PrimaryPart = vehicle.Chassis.VehicleSeat
  34. end
  35.  
  36. function farm() --This is where the magic happens :)
  37. hint.Text = "Finished loading! Autofarm initialized."
  38. while wait(waitTime) do --Waits x seconds before resetting car
  39. vehicle:SetPrimaryPartCFrame(CFrame.new(-2470,60,777)) --Teleports vehicle to highway
  40. game:GetService'VirtualUser':SetKeyUp("w") --Resets W key
  41. game:GetService'VirtualUser':SetKeyDown("w") --Presses W key to go forward
  42. end
  43. end
  44. findVehicle() --Calls the findVehicle function
  45. while go do
  46. if not pcall(farm()) then --Calls farm function & checks for errors
  47. found = false --If it errors, it sets found to false and continues looking for your vehicle.
  48. findVehicle()
  49. end
  50. end
Add Comment
Please, Sign In to add comment