N4TRIU

Bloxburg auto-farm

May 1st, 2019
1,301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. -- Variables --
  2. local remote = nil
  3. local orderInc = 0
  4. local workstationTable = {}
  5.  
  6. -- Metatable --
  7. function setupMetatable()
  8. warn("[?] Setting up the Metamethods.")
  9.  
  10. -- Metatable and Metamethods --
  11. local metatable = getrawmetatable(game)
  12. local backupNamecall = metatable.__namecall
  13.  
  14. -- Make metatable writeable --
  15. local setreadonly = make_writeable or setreadonly
  16. setreadonly(metatable, false)
  17.  
  18. -- Overwrite __namecall metamethod --
  19. metatable.__namecall = function(...)
  20. local args = {...}
  21. if(args[#args] == "FireServer") then
  22. if(args[2] and type(args[2]) == "table" and args[2]["Order"] and not workstationTable[args[2]["Workstation"]]) then
  23. warn("[!] Remote and Workstation have been found.")
  24. remote = args[1]
  25.  
  26. doWork(args[2]["Workstation"])
  27. end
  28. end
  29. return backupNamecall(...)
  30. end
  31. end
  32.  
  33. -- Get Order --
  34. function getOrder(workstation)
  35. local orderValue = workstation.Occupied.Value:WaitForChild("Order")
  36.  
  37. return {
  38. orderValue.Style.Value,
  39. orderValue.Color.Value
  40. }
  41. end
  42.  
  43. -- Main --
  44. warn("[?] Welcome to Hairdressers Farm Script!")
  45. warn("[?] By Luaa #0381")
  46. warn("[-] Go to work at the Hairdressers.")
  47. warn("[-] Complete an order.")
  48. warn("[-] Magic, it will now complete orders.")
  49. setupMetatable()
  50.  
  51. function doWork(workstation)
  52. local workEvent = nil
  53. local inUseEvent = nil
  54. workstationTable[workstation] = true
  55.  
  56. workEvent = workstation.Occupied.Changed:Connect(function(value)
  57. if(value == nil) then return end
  58.  
  59. local order = getOrder(workstation)
  60. remote:FireServer({
  61. Type = "FinishHair",
  62. Workstation = workstation,
  63. Order = order
  64. })
  65.  
  66. orderInc = orderInc + 1
  67. local date = os.date("*t", now)
  68. warn("[!] Finished Order => " .. orderInc .. " => " .. date["hour"] .. ":" .. date["min"])
  69. end)
  70.  
  71. inUseEvent = workstation.InUse.Changed:Connect(function(value)
  72. if(value ~= game:GetService("Players").LocalPlayer and workEvent ~= nil) then
  73. warn("[?] You have changed your workstation, stopping old workEvent and resetting metamethod.")
  74. workstationTable = {}
  75. workEvent:Disconnect()
  76. inUseEvent:Disconnect()
  77. end
  78. end)
  79. end
Add Comment
Please, Sign In to add comment