so when i hold mouse and than leave it it not heals but when i click many times its heals+
script:
local Tool = script.Parent
repeat wait() until Tool.Parent:IsA("Model")
local uis = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local char = Tool.Parent
local hum = char:WaitForChild("Humanoid")
local UseAnim = hum:LoadAnimation(Tool:WaitForChild("Animations").wrap)
local idle = hum:LoadAnimation(Tool:WaitForChild("Animations").idle)
Equipped = false
Used = false
Holding = false
function Equip()
Equipped = true
idle:Play()
Tool:WaitForChild("Handle").Unequip:Stop()
Tool:WaitForChild("Handle").Equip:Play()
end
function UnEquip()
Equipped = false
Tool:WaitForChild("Handle").Equip:Stop()
Tool:WaitForChild("Handle").Unequip:Stop()
Tool:WaitForChild("Handle").Wrap:Stop()
idle:Stop()
UseAnim:Stop()
end
uis.InputBegan:Connect(function(input)
if Equipped == true and char and hum and Holding == false and player and Used == false then
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
Holding = true
Used = true
Tool:WaitForChild("Handle").Equip:Stop()
Tool:WaitForChild("Handle").Wrap:Play()
local HealTime = 3.40
idle:Stop()
UseAnim:Play()
hum.WalkSpeed = 2
if Equipped and Holding then
if Holding then
task.wait(HealTime)
if Holding then
Tool:WaitForChild("EZ"):FireServer()
hum.WalkSpeed = 16
end
end
end
end
end
end)
uis.InputEnded:Connect(function(input)
if Equipped == true and char and hum and Holding == true and player then
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
Holding = false
UseAnim:Stop()
hum.WalkSpeed = 16
Tool:WaitForChild("Handle").Wrap:Stop()
if script.Parent then
Used = false
Holding = false
end
end
end
end)
Tool.Equipped:Connect(Equip)
Tool.Unequipped:Connect(UnEquip)