I am a newbie to scripting, and I am having trouble looping the script Azarth helped me with. I have tried many times with different types of loops, but nothing happens. I am stuck and have asked for help on the forums but nobody responded so I would appreciate help.
for i=1, 10 do
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local depletionAmount = 10
repeat until i<1
local function healthDeplete()
local currentHealth = humanoid.Health
-- wait(1)
local newHealth = currentHealth - depletionAmount
humanoid.Health = newHealth
end
healthDeplete()

12 comments
No, that is false that while true loops do not stop. You can use break.
Sorry, my bad :D
Thanks for the help dude but the health likes to regenerate and i'm not sure how to stop this :P
Ohh
You have to remove the healing script form player
humanoid.Parent.Health:Destroy() -- this will remove the healing effect
Thanks but when i put this in the script, it only depletes health one time. do i need to put in a seperate script?
Add this script to StarterPlayer -> StarterCharacterScripts
The script is already in that folder, do i need to put it in a specific part of the script? Also thanks for putting up with my newbie questions
You have to replace the loop code with humanoid.Parent.Health:Destroy() this one.
what do you mean by loop code? the while true do humanoid.health = humanoid. health - depletionAmount wait() end?
I messaged you, go check your inbox ;P