When you run this code in online mode, it causes a client crash, without any meaningful output to the client to be able to debug the problem. It only gives a proper error in Studio.
Repro in LocalScript:
[code]
local function attack()
print(“Attacking”)
wait(3)
print(“Done attacking”)
end