KrystekYY

Untitled

Nov 21st, 2018
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Fully automatic money/miles farm
  3. TODO:
  4. Add auto respawn vehicle
  5. ]]
  6. local waitTime = 3 --To zajmie czas (sekundy), aż samochód się zresetuje. Zobacz wiersz 37
  7. -- Nie zmieniaj niczego poniżej :)
  8. local hint = Instance.new('Hint', Workspace) hint.Text = "Vehicle Simulator Autofarm ładowanie..."
  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 = 800
  22. vehStats.Torque.Value = 100000
  23. vehStats.SteeringRadiusConstant.Value = 120000000
  24. elseif vehicles[i + 1] == nil and not found then
  25. --Autorespawn would go here
  26. hint.Text = "Proszę odradzić się i zespawnuj swój pojazd!" --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 = "Ładowanie Zakończone! Autofarm Załadowany."
  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
RAW Paste Data