Hi. So I am making an AI that shoots people. Everything is working but, when I use: Animation.Stopped:Wait()
It pauses the script until the animation is stopped. So my loop wont continue running until the animation is finished. I expected this but I don’t know how to fix it, what alternatives are there?
If you don’t want wait() to yield the entire thread, then you should use task.spawn(function(). It lets you run a separate thread without stopping the entire code.
Ohh I didnt realise task.spawn did that. Thank you. Would it be something like this?
local function AimGun(target)
Animation:Play()
Animation.Stopped:Wait()
print("Stopped")
end
while true do
print("Working")
if db == false then
task.spawn(AimGun(target))
end
end