Advertisement
Sungmingamerpro13

Pizza with Stocks

Apr 3rd, 2024
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.29 KB | None | 0 0
  1. local PizzaNumber = 10
  2.  
  3. local PizzaBox = script.Parent
  4.  
  5. local Name = "Pizza"
  6.  
  7. local ClickDetector = Instance.new("ClickDetector", PizzaBox)
  8. local Proximity = Instance.new("ProximityPrompt", PizzaBox)
  9.  
  10. local TextLabel = script.Parent.PizzaStocks.stocksLabel
  11.  
  12. TextLabel.Text = Name.." ["..PizzaNumber.." Stock]"
  13.  
  14. ClickDetector.MouseClick:Connect(function(player)
  15.     TextLabel.Text = Name.." ["..PizzaNumber.." Stock]"
  16.  
  17.     PizzaNumber -= 1
  18.     game.ServerStorage.Foods[Name]:Clone().Parent = player.Backpack
  19. end)
  20.  
  21. while wait() do
  22.     if PizzaNumber == 0 then
  23.         PizzaBox.Transparency = 0.8
  24.         PizzaBox.Pizza_Icon.Transparency = 0.8
  25.         wait(1)
  26.         break
  27.     end
  28. end
  29.  
  30. ClickDetector.MouseHoverEnter:Connect(function()
  31.     if not script.Parent:FindFirstChild("SelectionBox") then
  32.         local Selection = Instance.new("SelectionBox")
  33.         Selection.Adornee = script.Parent
  34.         Selection.Parent = script.Parent
  35.         Selection.Color3 = Color3.new(1, 1, 1)
  36.         Selection.Transparency = 0.8
  37.     end
  38. end)
  39.  
  40. ClickDetector.MouseHoverLeave:Connect(function()
  41.     if script.Parent:FindFirstChild("SelectionBox") then
  42.         script.Parent.SelectionBox:Destroy()
  43.     end
  44. end)
  45.  
  46. Proximity.Triggered:Connect(function(player)
  47.     local PizzaBox = player.Character:FindFirstChild("PizzaBox")
  48.  
  49.     PizzaBox:Destroy()
  50.     PizzaBox.Transparency = 0
  51.  
  52. end)
  53.  
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement