So basically I made an ultra coil that heals, increases speed and jump for the player. But for some reason, the ultra coil also damages me over time when it's not programmed to? This is on a local script and I don't really know what to fix so please help.
local tool = script.Parent
local speed = 25
local jump = 5
local health = 7
local active = false
tool.Equipped:Connect(function()
active = true
local player = game.Players:FindFirstChild(tool.Parent.Name)
if player then
player.Character.Humanoid.WalkSpeed = player.Character.Humanoid.WalkSpeed + speed
player.Character.Humanoid.JumpHeight = player.Character.Humanoid.JumpHeight + jump
while active do
wait(1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + health
end
end
end)
tool.Unequipped:Connect(function()
active = false
local player = tool.Parent.Parent
if player then
player.Character.Humanoid.WalkSpeed = player.Character.Humanoid.WalkSpeed - speed
player.Character.Humanoid.JumpHeight = player.Character.Humanoid.JumpHeight - jump
end
end)
