Advertisement
DEXLTH

Ben's Ice Cream

Jul 19th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. function handle()
  2. game.ReplicatedStorage.DataEvent:FireServer({Type = 'TakeIceCreamCup'})
  3. wait(.1)
  4. local plr = game:GetService'Players'.LocalPlayer.Name
  5. -- Finish Order
  6. local flavours = {'Vanilla', 'Chocolate', 'Strawberry'}
  7. local extra = {'Sprinkles', 'Nuts', 'Caramel'}
  8. local stuff
  9. local event = game.ReplicatedStorage.DataEvent
  10.  
  11. local send_valid = function()
  12. for k,v in next, workspace.BensIceCream.CustomerTargets:GetChildren()do
  13. if v.Occupied.Value ~= nil then
  14. return v
  15. end
  16. end
  17. end
  18.  
  19. for s,j in next, workspace.SpawnedCharacters:GetChildren() do
  20. if j.Name:find('BensIceCream') then
  21. local char = j
  22. local p = send_valid()
  23. if p.Occupied.Value:FindFirstChild('Order') then
  24. stuff = {}
  25. for _,x in next, p.Occupied.Value.Order:GetChildren()do
  26. table.insert(stuff, x.Value)
  27. end
  28. end
  29. end
  30. end
  31.  
  32. local ball = function()
  33. if workspace[plr]:FindFirstChild('Ice Cream Cup'):WaitForChild'Ball1'.Transparency == 1 then
  34. return workspace[plr]:FindFirstChild('Ice Cream Cup').Ball1
  35. elseif workspace[plr]:FindFirstChild('Ice Cream Cup'):WaitForChild'Ball2'.Transparency == 1 then
  36. return workspace[plr]:FindFirstChild('Ice Cream Cup').Ball2
  37. end
  38. end
  39.  
  40. table.foreach(flavours, function(s,l)
  41. for k,v in next, stuff do
  42. if l:lower() == v:lower() then
  43. local new = ball()
  44. event:FireServer({
  45. Type = "AddIceCreamScoop",
  46. Taste = v,
  47. Ball = new,
  48. })
  49. new.Transparency = 0
  50. end
  51. end
  52. end)
  53.  
  54. table.foreach(extra, function(s,l)
  55. for k,v in next, stuff do
  56. if l:lower() == v:lower() then
  57. event:FireServer({
  58. Type = "AddIceCreamTopping",
  59. Taste = l
  60. })
  61. end
  62. end
  63. end)
  64. wait()
  65. for k,v in next, workspace.BensIceCream.CustomerTargets:GetChildren()do
  66. if v.Occupied.Value ~= nil then
  67. game.ReplicatedStorage.DataEvent:FireServer({Type = 'FinishOrder', Workstation = v})
  68. end
  69. end
  70. end
  71.  
  72. for k,v in next, workspace.BensIceCream.CustomerTargets:GetChildren()do
  73. v.Occupied:GetPropertyChangedSignal('Value'):Connect(function()
  74. handle()
  75. end)
  76. end
  77. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement