Advertisement
Sungmingamerpro13

New Wood System 2 (Planks)

Apr 10th, 2024
892
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.12 KB | None | 0 0
  1. local Tool = script.Parent
  2.  
  3. local player = game.Players.LocalPlayer
  4. local backpack = player.PlayerGui:WaitForChild("BackpackGui")
  5. local Planks = backpack.Frame:WaitForChild("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.Frame.Planks.Visible = false
  19.    
  20.    
  21. end)
  22.  
  23. Tool.Activated:Connect(function()
  24.     local plank = Instance.new("Part")
  25.     plank.Name = "Plank"
  26.     plank.Anchored = true
  27.     plank.Material = Enum.Material.WoodPlanks
  28.  
  29.     local Pos = Mouse.Hit.Position
  30.  
  31.     plank.Size = Vector3.new(9, 0.2, 2)
  32.     plank.Position =  Pos
  33.     plank.Color = Color3.fromRGB(105, 64, 40)
  34.  
  35.     plank.Parent = workspace
  36.     Tool.plankstacks.Value = Tool.plankstacks.Value - 1
  37.    
  38.     while wait() do
  39.         if Tool.plankstacks.Value == 0 then
  40.             Tool:Destroy()
  41.             backpack.Frame.Planks.Visible = false
  42.             wait(1)
  43.             break
  44.         end
  45.     end
  46. end)
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement