Advertisement
Sungmingamerpro13

Tool With Stacks (Tool Stacks System)

May 1st, 2024 (edited)
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.67 KB | None | 0 0
  1. local Tool = script.Parent
  2.  
  3. local player = game.Players.LocalPlayer
  4. local ChangedText = player.PlayerGui:WaitForChild("BackpackGui").Frame.ChangedText
  5.  
  6. local number = 5
  7.  
  8. Tool:WaitForChild("stacks").Changed:Connect(function(value)
  9.     ChangedText.Text = "Changed: "..value
  10. end)
  11.  
  12. ChangedText.Text = "Changed: "..Tool.stacks.Value
  13.  
  14. Tool.Activated:Connect(function()
  15.     Tool.stacks.Value -= 1
  16.  
  17.     if Tool.stacks.Value == 0 then
  18.         player.Character.Humanoid.Health += number
  19.         Tool:Destroy()
  20.         ChangedText.Visible = false
  21.     end
  22. end)
  23.  
  24. Tool.Equipped:Connect(function()
  25.     ChangedText.Visible = true
  26. end)
  27.  
  28. Tool.Unequipped:Connect(function()
  29.     ChangedText.Visible = false
  30. end)
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement