Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables --
- local inUseEvent = nil
- local workEvent = nil
- local remote = nil
- local workstation = nil
- local orderInc = 0
- local findRemWork = true
- -- Metatable --
- function setupMetatable()
- warn("[?] Setting up the Metamethods.")
- -- Metatable and Metamethods --
- local metatable = getrawmetatable(game)
- local backupNamecall = metatable.__namecall
- -- Make metatable writeable --
- local setreadonly = make_writeable or setreadonly
- setreadonly(metatable, false)
- -- Overwrite __namecall metamethod --
- metatable.__namecall = function(...)
- local args = {...}
- if(args[#args] == "FireServer") then
- if(args[2] and type(args[2]) == "table" and args[2]["Order"] and findRemWork) then
- warn("[!] Remote and Workstation have been found.")
- findRemWork = false
- remote = args[1]
- workstation = args[2]["Workstation"]
- doWork()
- end
- end
- return backupNamecall(...)
- end
- end
- -- Find Customer --
- function getOrder(workstation)
- local orderValue = workstation.Occupied.Value:WaitForChild("Order")
- return {
- orderValue.Burger.Value,
- orderValue.Fries.Value,
- orderValue.Cola.Value
- }
- end
- -- Main --
- warn("[?] Welcome to Bloxy Burgers Farm Script!")
- warn("[?] By Luaa #0381")
- warn("[-] Go to work at Bloxy Burgers.")
- warn("[-] Complete an order.")
- warn("[-] Magic, it will now complete orders.")
- setupMetatable()
- function doWork()
- workEvent = workstation.Occupied.Changed:Connect(function(value)
- if(value == nil) then return end
- local order = getOrder(workstation)
- remote:FireServer({
- Type = "FinishOrder",
- Workstation = workstation,
- Order = order
- })
- orderInc = orderInc + 1
- local date = os.date("*t", now)
- warn("[!] Finished Order => " .. orderInc .. " => " .. date["hour"] .. ":" .. date["min"])
- end)
- inUseEvent = workstation.InUse.Changed:Connect(function(value)
- if(value ~= game:GetService("Players").LocalPlayer and workEvent ~= nil) then
- warn("[?] You have changed your workstation, stopping old workEvent and resetting metamethod.")
- findRemWork = true
- workEvent:Disconnect()
- inUseEvent:Disconnect()
- end
- end)
- end
Add Comment
Please, Sign In to add comment