Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how to make ll script false if an ai's health equals 0?

I have not tried as of yet because i do not know where to start. However if i were to have a follow brick that had health with code similar to this:

local torso = findNearestTorso(bin.Position)
if torso~=nil then
	move(torso)
	moveTo(torso)
end
wait()

end

how would i deny any of that script if i the health of the brick ai equaled 0?

1 answer

local torso = findNearestTorso(bin.Position)
if torso and torso.Health > 0 then
    move(torso)
    moveTo(torso)
end
wait()

Pretty self explanatory, assuming I've understood your question. Comment any questions!

2 comments

0

You're currently allowing the function to happen if the player is dead. Make it torso.Health > 0

0

Oh I am, thanks! Wasn't thinking!

This discussion is preserved as it was. New answers, comments, and votes are closed.