Advertisement
Sungmingamerpro13

New ToolScript With QuantityText (UPDATE)

Feb 8th, 2025 (edited)
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.48 KB | None | 0 0
  1. local Tool = script.Parent
  2.  
  3. local player = game.Players.LocalPlayer
  4. local QuantityText = player.PlayerGui:WaitForChild("BackpackGui").Frame.Quantity
  5. local Enabled = true
  6.  
  7. Tool:WaitForChild("stacks").Changed:Connect(function(value)
  8.     QuantityText.Text = "Quantity: "..value
  9. end)
  10.  
  11. QuantityText.Text = "Quantity: "..Tool.stacks.Value
  12.  
  13. Tool.Activated:Connect(function()
  14.     if not Enabled then
  15.         return
  16.     end
  17.    
  18.     Enabled = false
  19.    
  20.     Tool.GripForward = Vector3.new(-0.976,0,-0.217)
  21.     Tool.GripPos = Vector3.new(.95,-0.76,1.4)
  22.     Tool.GripRight = Vector3.new(0.217,0, 0.976)
  23.     Tool.GripUp = Vector3.new(0,1,0)
  24.  
  25.     wait(.8)
  26.  
  27.     local Humanoid = player.Character:FindFirstChild("Humanoid")
  28.     if (Humanoid ~= nil) then
  29.         if (Humanoid.MaxHealth > Humanoid.Health + 1.6) then
  30.             Humanoid.Health = Humanoid.Health + 1.6
  31.         else    
  32.             if Humanoid.Health == Humanoid.MaxHealth then
  33.                 if Tool:WaitForChild("stacks") and Tool.stacks.Value > 1 then
  34.                     Tool.stacks.Value = Tool.stacks.Value - 1
  35.                 else
  36.                     Tool:Destroy()
  37.                     QuantityText.Visible = false
  38.                 end
  39.             end
  40.         end
  41.     end
  42.  
  43.     Tool.GripForward = Vector3.new(-0.976,0,-0.217)
  44.     Tool.GripPos = Vector3.new(0.3,0,0)
  45.     Tool.GripRight = Vector3.new(0.217,0,-0.976)
  46.     Tool.GripUp = Vector3.new(0,1,0)
  47.  
  48.     Enabled = true
  49. end)
  50.  
  51. Tool.Equipped:Connect(function()
  52.     QuantityText.Visible = true
  53.     QuantityText.Text = "Quantity: "..Tool.stacks.Value
  54. end)
  55.  
  56. Tool.Unequipped:Connect(function()
  57.     QuantityText.Visible = false
  58. end)
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement