DEXLTH

Bloxy Burger

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