Advertisement
Sungmingamerpro13

PizzaBoxScript

Sep 26th, 2023
891
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.57 KB | None | 0 0
  1. local PizzaBox = script.Parent
  2.  
  3. local ServerStorage = game:GetService("ServerStorage")
  4.  
  5. for i, Pizza in pairs(PizzaBox:GetChildren()) do
  6.     if Pizza:IsA("BasePart") then
  7.        
  8.         local ClickDetector = Instance.new("ClickDetector", Pizza)
  9.         ClickDetector.MaxActivationDistance = 16
  10.        
  11.         ClickDetector.MouseClick:Connect(function(player)
  12.             if player and player.Character then
  13.                 local Backpack = player:WaitForChild("Backpack")
  14.                 local Tool = ServerStorage:WaitForChild("Pizza")
  15.                 Pizza:Destroy()
  16.                 Tool:Clone().Parent = player.Backpack
  17.             end
  18.         end)
  19.     end
  20. end
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement