I have no idea how to stop a function. Is there any way to do so?
function fish()
print("dog")
wait(1)
print("cat")
wait(1)
print("yes")
end
while wait() do
if health.Value == 0 then
fish:Stop() -- Is there anyway to do something like this?
end
end

4 comments
you can just ignore the function or put debounce on the fish()
ew don't use wait() as your loop's condition
incapaz, why?
Using 'wait()' as a while condition apparently slows down performance by some (practically unnoticeable) amount because Lua has to do a couple extra steps to ensure that 'wait()' actually returns a non-false/nil value. I doubt you'd notice the difference even if you had thousands of such loops running simultaneously.