So I'm making a game with a lot of combat and I'm trying to make a button heal. I've tested my code and it didn't work. Is there a way to increase player's health? Here is my code:
local part = script.Parent
local function Activated(player)
script.Parent.ClickDetector.MaxActivationDistance = 0
script.Parent.Sound:Play()
player.Character.Torso.Anchored = true
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
wait (1)
player.Character.Humanoid.Health = player.Character.Humanoid.Health + 375
player.Character.Torso.Anchored = false
script.Parent.Sound:Stop()
script.Parent.ClickDetector.MaxActivationDistance = 10
end
part.ClickDetector.MouseClick:Connect(Activated)
