Advertisement
ustinjamesss

busy buisness screept

Dec 14th, 2022
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. --credits to: AFriendlyNewUser https://v3rmillion.net/member.php?action=profile&uid=1730545
  2.  
  3. local currentPlot;
  4. for i, v in pairs(workspace.Plots:GetChildren()) do
  5. if v:FindFirstChild("Owner") and v.Owner.Value == game.Players.LocalPlayer then
  6. currentPlot = v
  7. end
  8. end
  9.  
  10. local useMachine = game:GetService("ReplicatedStorage").Communication.UseMachine
  11. local orderCustomer = game:GetService("ReplicatedStorage").Communication.CustomerOrder
  12. local serveCustomer = game:GetService("ReplicatedStorage").Communication.ServeCustomer
  13. local ServerScriptService = game:GetService("ServerScriptService")
  14. task.spawn(function()
  15. while task.wait(1) do
  16. for i, v in pairs(currentPlot.Customers:GetChildren()) do
  17. if not v:GetAttribute("OrderTaken") then
  18. orderCustomer:FireServer(v)
  19. end
  20. end
  21. end
  22. end)
  23.  
  24. function getItem(Item)
  25. local vStation;
  26. for i, v in pairs(currentPlot.Objects:GetChildren()) do
  27. if v:FindFirstChild("Item") and v.Item.Value == Item then
  28. vStation = v
  29. end
  30. end
  31.  
  32. useMachine:FireServer(vStation, false)
  33. useMachine:FireServer(vStation, true)
  34. end
  35.  
  36.  
  37. task.spawn(function()
  38. while task.wait(1) do
  39. for i, v in pairs(currentPlot.Customers:GetChildren()) do
  40. if not (v:GetAttribute("Count") == 0) and v:GetAttribute("Count") and tonumber(v:GetAttribute("Count")) >= 1 then
  41. local customerItem = v:GetAttribute("Item")
  42. if not customerItem then continue end
  43. for i = 1, v:GetAttribute("Count") do
  44. getItem(customerItem)
  45. serveCustomer:FireServer(v)
  46. end
  47. end
  48. end
  49. end
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement