I have a crawling animation that i want to run when humainoid health = 1 and then to stop playing once health reaches back to 101 hp anybody able to explain? *I'm not asking for a script a detailed explanation and example will do just fine, Thanks *
COMMUNITY QUESTION
How Do I Play A Function At A Required Time?
2 answers
Use a function which is basically an event that starts the whole script. The specific one you're looking for is called HealthChanged. Click here for a detailed tutorial to help you write your script.
1 comment
0
A function is not an "event that starts the whole script", it is a container of reusable code.
This is small script (It may doesn't work but can show you how it need look like.) Of course if u want auto-healing in game.
repeat
if humanoid.Health = 1 then
wait(10/5/2/3/100500)
humanoid.Health = humanoid.Health + 1
until humanoid.Health = 101
But if you don't like to have auto-healing. Use this
local randomvariable = 0
if humanoid.Health = 1 then
randomvariable = 1
startyouranimationhere
end
if humanoid.Health = 101 then
if randomvariable = 1 then
stopyouranimation
end
1 comment
0
Ya u can just use function instead coupleofstrokes. :\
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You would want to use "HealthChanged" then check for the current health after every health change using an if statement. If the health is equal to 1 or 101 then you would do as you need. https://developer.roblox.com/api-reference/event/Humanoid/HealthChanged