Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tool = script.Parent -- the tool, parent of this script
- local handle = tool:WaitForChild("Handle",1) -- the handle in the tool
- local liquid = handle:WaitForChild("Liquid",1) -- the 'liquid' in the tool
- local sound = handle:WaitForChild("Sound",1) -- the 'sound' effect
- local debris = game:GetService("Debris") -- timed destroy
- local oncd = false -- cooldown boolean
- local cooldown = 1 -- cooldown time
- local maxuses = 3 -- maximum use of the potion
- local uses = 0 -- amount of use of the potion
- local heal = 30 -- health potion, amount to heal
- function effect() -- activate the effect
- local humanoid = tool.Parent:FindFirstChildOfClass("Humanoid") -- find the 'humanoid'
- if humanoid then -- checking if the 'humanoid' is there
- humanoid.Health = humanoid.Health + heal -- adding the amount to heal
- local cloneS = sound:Clone()
- cloneS.PlayOnRemove = true -- play the sound on remove
- cloneS.Parent = handle -- parent of the sound
- cloneS:Destroy() -- play the sound
- end
- end
- function activate()
- if uses < maxuses and oncd == false then -- checking the times the tool was used and checking the if the tool is on cooldown too
- uses = uses + 1
- oncd = true
- effect()
- task.delay(cooldown,function()
- oncd = false
- end)
- liquid.Transparency = uses/maxuses
- if uses >= maxuses then
- debris:AddItem(tool,sound.TimeLength+.5)
- end
- end
- end
- tool.Activated:Connect(activate)
- -- Made by TrolledTrollage, 3/22/2022 (Subscribe to Er1x on Youtube)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement