Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Tool = script.Parent;
- local player = game.Players.LocalPlayer
- local QuantityLabel = player.PlayerGui:WaitForChild("QuantityGui").quantityLabel
- enabled = true
- function onActivated()
- if not enabled then
- return
- end
- enabled = false
- wait(.8)
- local Humanoid = player.Character:FindFirstChild("Humanoid")
- local EatAnimation = Humanoid:LoadAnimation(script.Parent.EatAnimation)
- if (Humanoid ~= nil) then
- if (Humanoid.MaxHealth > Humanoid.Health + 1.6) then
- Humanoid.Health = Humanoid.Health + 1.6
- else
- if Humanoid.Health == Humanoid.MaxHealth then
- if Tool:WaitForChild("stacks") and Tool.stacks.Value > 1 then
- print(Tool.Name.." ("..Tool.stacks.Value..")")
- Tool.stacks.Value = Tool.stacks.Value - 1
- script.Parent.heal:Play()
- EatAnimation:Play()
- else
- Tool:Destroy()
- QuantityLabel.Visible = false
- end
- end
- end
- end
- enabled = true
- end
- Tool:WaitForChild("stacks").Changed:Connect(function(Value)
- QuantityLabel.Text = "Quantity: "..Value
- end)
- QuantityLabel.Text = "Quantity: "..Tool.stacks.Value
- script.Parent.Activated:connect(onActivated)
- script.Parent.Equipped:Connect(function()
- QuantityLabel.Visible = true
- QuantityLabel.Text = "Quantity: "..Tool.stacks.Value
- end)
- script.Parent.Unequipped:Connect(function()
- QuantityLabel.Visible = false
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement