Advertisement
Sungmingamerpro13

Plank System (QuantityText)

May 12th, 2024
698
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.15 KB | None | 0 0
  1. local Tool = script.Parent
  2.  
  3. local player = game.Players.LocalPlayer
  4. local backpack = player.PlayerGui:WaitForChild("QuantityGui")
  5. local Planks = backpack:FindFirstChild("Planks")
  6. local Mouse = player:GetMouse()
  7.  
  8. Tool.Equipped:Connect(function()
  9.     backpack.Frame.Planks.Visible = true
  10.    
  11.     Tool.plankstacks:GetPropertyChangedSignal('Value'):Connect(function()
  12.         Planks.TextLabel.Text = Tool.plankstacks.Value.." / 10"
  13.     end)
  14.     Planks.TextLabel.Text = Tool.plankstacks.Value.." / 10"
  15. end)
  16.  
  17. Tool.Unequipped:Connect(function()
  18.     backpack.Planks.Visible = false
  19.    
  20.    
  21. end)
  22.  
  23. local function MakePlank()
  24.  
  25.     local plank = Instance.new("Part")
  26.     plank.Name = "Plank"
  27.     plank.Anchored = true
  28.     plank.Material = Enum.Material.Plastic
  29.    
  30.     local Pos = Mouse.Hit.Position
  31.  
  32.     plank.Size = Vector3.new(12, 0.2, 4)
  33.     plank.Position =  Pos
  34.     plank.Color = Color3.fromRGB(105, 64, 40)
  35.  
  36.     plank.Parent = workspace
  37.     Tool.plankstacks.Value = Tool.plankstacks.Value - 1
  38. end
  39.  
  40. Tool.Activated:Connect(function()
  41.     MakePlank()
  42.    
  43.     while wait() do
  44.         if Tool.plankstacks.Value == 0 then
  45.             Tool:Destroy()
  46.             backpack.Planks.Visible = false
  47.             wait(1)
  48.             break
  49.         end
  50.     end
  51. end)
  52.  
  53.  
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement