I was making a small zombie-shooting game.But a problem occured.I was trying to make a gui pop up when all the zombies are dead.But I couldnt figure out how to do that.I tried “repeat until” and “while”.But could not do that.I dont need scripts.Just give me a solution.
2 Likes
When you spawn the zombies, you could store the number of zombies in a variable. Then you could connect a function to Humanoid.Died
of each zombie and in that function, decrease the variable by one and if it’s 0 after that, do something.
1 Like
Oh! thanks…I was thinking about that last night.
1 Like
you could bind it to an event, or do
while not Condition do
wait()
end
this way, as long as the condition hasn’t been met yet, it will keep waiting.
3 Likes
The best way to achieve this is by doing repeat wait() until something == true
2 Likes
thnx .! i will inform you if this works
Why not just wait until all the zombies are dead and then call the function? Like use a variable to check the number of zombies. And when it reaches 0,you call the variable.
1 Like