Sir_Spaceboi

module

Apr 10th, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.99 KB | None | 0 0
  1. local orderingSystem = {}
  2.  
  3. local itemsInOrder = 0
  4. local totalOrderPrice = 0
  5.  
  6. local Blur1 = script.Parent.OrderingSystem.BlurThing1
  7. local toppingsFrame = script.Parent.OrderingSystem.toppingsFrame
  8. local sizeFrame = script.Parent.OrderingSystem.sizeFrame
  9. local signInFrame = script.Parent.OrderingSystem.signInFrame
  10. local customerWaitFrame = script.Parent.OrderingSystem.customerWaitFrame
  11.  
  12. local Info = TweenInfo.new(7, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
  13. local Info2 = TweenInfo.new(2, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
  14. local ShowTweenPrm = {BackgroundTransparency = 1}
  15. local HideTweenPrm = {BackgroundTransparency = 0.25}
  16. local HideToppingsParam = {Position = UDim2.new(0.35, 0,1, 0)}
  17. local SignInFrameParam = {Position = UDim2.new(0.35, 0,1, 0)}
  18.  
  19. local TweenService = game:GetService("TweenService")
  20.  
  21. function orderingSystem.removeItem()
  22.     itemsInOrder = itemsInOrder - 1
  23. end
  24.  
  25. function orderingSystem.openRegister(Player, RegNum)
  26.     local Prompt = script.Parent.Parent.Parent.Prompt.ProximityPrompt
  27.     Prompt.Enabled = false
  28.    
  29.     wait(.7)
  30.    
  31.     local CreateSignInTween = TweenService:Create(signInFrame, Info2, SignInFrameParam)
  32.     CreateSignInTween:Play()
  33.    
  34.     wait(.6)
  35.  
  36.     local CreateShowTween = TweenService:Create(Blur1, Info, ShowTweenPrm)
  37.     CreateShowTween:Play()
  38.    
  39.     game.ReplicatedStorage.OrderingSystemZoom:FireClient(Player, RegNum)
  40. end
  41.  
  42. function orderingSystem.categoryClicked(item)
  43.     if item.Value == "iceCream" then
  44.         script.Parent.OrderingSystem.smoothieItems:TweenPosition(UDim2.new(0, 0,1, 0), nil, nil, 1.5)
  45.         script.Parent.OrderingSystem.iceCreamItems:TweenPosition(UDim2.new(0, 0,0.03, 0), nil, nil, 1.5)
  46.     end
  47.     if item.Value == "smoothie" then
  48.         script.Parent.OrderingSystem.iceCreamItems:TweenPosition(UDim2.new(0, 0,1, 0), nil, nil, 1.5)
  49.         script.Parent.OrderingSystem.smoothieItems:TweenPosition(UDim2.new(0, 0,0.03, 0), nil, nil, 1.5)
  50.     end
  51. end
  52.  
  53. function orderingSystem.addItem(itemName, price, itemType, extra, from)
  54.     if itemsInOrder ~= 3 and game.Players[script.Parent.Parent.Parent.Cashier.Value].IsMakingOrder.Value == false then
  55.         game.Players[script.Parent.Parent.Parent.Cashier.Value].IsMakingOrder.Value = true
  56.         print(from)
  57.         if itemType == "ICE CREAM" then
  58.             if from ~= "toppings" then
  59.                 print(extra)
  60.                 local itemClone = script.Parent.sampleItem:Clone()
  61.                 itemClone.Parent = script.Parent.OrderingSystem.OrderList
  62.                 itemClone.Name = itemsInOrder + 1
  63.                 itemClone.itemExtraLabel.Text = ""
  64.  
  65.                 itemClone.itemNameLabel.Text = string.upper(string.sub(itemName, 1, 1)) .. string.lower(string.sub(itemName, 2)) .." " .. string.upper(string.sub(itemType, 1, 1)) .. string.lower(string.sub(itemType, 2))
  66.                 itemClone.itemPriceLabel.Text = "$" .. price
  67.  
  68.                 print(string.upper(string.sub(itemName, 1, 1)) .. string.lower(string.sub(itemName, 2)))
  69.                 itemsInOrder = itemsInOrder + 1
  70.                 totalOrderPrice = totalOrderPrice + price
  71.                 print("$" .. totalOrderPrice)
  72.  
  73.                 local CreateShowTween = TweenService:Create(Blur1, Info, HideTweenPrm)
  74.                 CreateShowTween:Play()
  75.  
  76.                 local toppingsFrame = script.Parent.OrderingSystem.toppingsFrame
  77.                 toppingsFrame:TweenPosition(UDim2.new(0.35, 0,0.35, 0), nil, nil, 2)
  78.                 print()
  79.             end
  80.  
  81.             function orderingSystem.addToppingsToIcecream(extra)
  82.                 local CreateShowTween = TweenService:Create(Blur1, Info, ShowTweenPrm)
  83.                 CreateShowTween:Play()
  84.  
  85.                 if extra == "gummyBears" then
  86.                     extra = "Gummy Bears"
  87.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  88.                 end            
  89.                 if extra == "crushedOreo" then
  90.                     extra = "Crushed Oreos"
  91.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  92.                 end            
  93.                 if extra == "chocolateChips" then
  94.                     extra = "Chocolate Chips"
  95.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  96.                 end            
  97.                 if extra == "sprinkles" then
  98.                     extra = "Sprinkles"
  99.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  100.                 end
  101.                 if extra == "skip" then
  102.                     extra = "No Toppings"
  103.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  104.                 end
  105.                 print("Found item " .. itemsInOrder)
  106.  
  107.                 local toppingsFrameTween = TweenService:Create(toppingsFrame, Info2, HideToppingsParam)
  108.                 toppingsFrameTween:Play()
  109.                
  110.                 print(totalOrderPrice)
  111.                 script.Parent.OrderingSystem.SendButton.Text = "Charge Customer $" .. totalOrderPrice
  112.                 game.Players[script.Parent.Parent.Parent.Cashier.Value].IsMakingOrder.Value = false
  113.             end
  114.         end
  115.         if itemType == "SMOOTHIE" then
  116.             if from ~= "size" then
  117.                 print(extra)
  118.                 local itemClone = script.Parent.sampleItem:Clone()
  119.                 itemClone.Parent = script.Parent.OrderingSystem.OrderList
  120.                 itemClone.Name = itemsInOrder + 1
  121.                 itemClone.itemExtraLabel.Text = ""
  122.  
  123.                 itemClone.itemNameLabel.Text = string.upper(string.sub(itemName, 1, 1)) .. string.lower(string.sub(itemName, 2)) .." " .. string.upper(string.sub(itemType, 1, 1)) .. string.lower(string.sub(itemType, 2))
  124.                 itemClone.itemPriceLabel.Text = "$" .. price
  125.  
  126.                 print(string.upper(string.sub(itemName, 1, 1)) .. string.lower(string.sub(itemName, 2)))
  127.                 itemsInOrder = itemsInOrder + 1
  128.                 totalOrderPrice = totalOrderPrice + price
  129.                 print("$" .. totalOrderPrice)
  130.  
  131.                 local CreateShowTween = TweenService:Create(Blur1, Info, HideTweenPrm)
  132.                 CreateShowTween:Play()
  133.  
  134.                 sizeFrame:TweenPosition(UDim2.new(0.35, 0,0.35, 0), nil, nil, 2)
  135.                 print()
  136.             end
  137.  
  138.             function orderingSystem.addSizeToSmoothie(extra)
  139.                 local CreateShowTween = TweenService:Create(Blur1, Info, ShowTweenPrm)
  140.                 CreateShowTween:Play()
  141.  
  142.                 if extra == "small" then
  143.                     extra = "Small"
  144.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  145.                     price = 5
  146.                 end            
  147.                 if extra == "large" then
  148.                     extra = "Large"
  149.                     script.Parent.OrderingSystem.OrderList:FindFirstChild(itemsInOrder).itemExtraLabel.Text = extra
  150.                     price = 7
  151.                 end            
  152.                 print("Found item " .. itemsInOrder)
  153.  
  154.                 local sizeFrameTween = TweenService:Create(sizeFrame, Info2, HideToppingsParam)
  155.                 sizeFrameTween:Play()
  156.  
  157.                 print(totalOrderPrice)
  158.                 script.Parent.OrderingSystem.SendButton.Text = "Charge Customer $" .. totalOrderPrice
  159.                 game.Players[script.Parent.Parent.Parent.Cashier.Value].IsMakingOrder.Value = false
  160.             end
  161.         end
  162.     else
  163.         return orderingSystem
  164.     end
  165. end
  166.  
  167. function orderingSystem.completeOrder()
  168.     --{0.35, 0},{0.35, 0}
  169.     customerWaitFrame:TweenPosition(UDim2.new(0.35, 0,0.35, 0),nil, nil, 2)
  170.     local CreateShowTween = TweenService:Create(Blur1, Info, HideTweenPrm)
  171.     CreateShowTween:Play()
  172.     script.Parent.Parent.Parent.Reader.Prompt.ProximityPrompt.ActionText = "Pay $" .. totalOrderPrice
  173.     script.Parent.Parent.Parent.Reader.Prompt.ProximityPrompt.Enabled = true
  174. end
  175.  
  176. function orderingSystem.customerFinishedOrder(Player, Price)
  177.     customerWaitFrame:TweenPosition(UDim2.new(0.35, 0,1, 0),nil, nil, 2)
  178.     local CreateShowTween = TweenService:Create(Blur1, Info, ShowTweenPrm)
  179.     CreateShowTween:Play()
  180.  
  181.     local CashierName = script.Parent.Parent.Parent.Cashier.Value
  182.  
  183.     script.Parent.Parent.Parent.Reader.Prompt.ProximityPrompt.Enabled = false
  184.     print(Player.Name .. "'s order was just submitted.")
  185.     game.Players[Player.Name].leaderstats.Coins.Value = game.Players[Player.Name].leaderstats.Coins.Value - totalOrderPrice
  186.    
  187.     ------------------------
  188.    
  189.     customerWaitFrame.Body.Text = "Transaction Approved!"
  190.     game.Players[CashierName].PlayerGui.OrderingSummary.Summary:TweenPosition(UDim2.new(0.885, 0,0.045, 0), nil, nil, 2)
  191.     game.Players[CashierName].PlayerGui.OrderingSummary.Summary.UserOrder.Text = Player.Name .. "'s Order"
  192.     wait(2)
  193.    
  194.    
  195.     for i,v in pairs(script.Parent.OrderingSystem.OrderList:GetChildren()) do
  196.         if v:IsA("Frame") then
  197.             v:Destroy()
  198.             itemsInOrder = 0
  199.             totalOrderPrice = 0
  200.             script.Parent.OrderingSystem.SendButton.Text = "Charge Customer $0"
  201.         end
  202.     end
  203. end
  204.  
  205. return orderingSystem
Advertisement
Add Comment
Please, Sign In to add comment