made this script for an npc so its attacks don't happen at the same time
its tweens kept interrupting eachother so after a while i came up with this and it seems to work but tell me if you see any issues
task.wait(1)
game:GetService('RunService').Heartbeat:wait()
local r = nearestPlayer()
if Order == 1 and CD1 == false then
CD1 = true
local Randomlook = math.random(5,8)
CurrentlyLooking = true
print("function1")
startattack()
task.wait(Randomlook)
CD1 = false
Order = Order + 1
elseif Order == 2 and CD1 == false then
CD1 = true
task.wait(1)
Attack = true
CurrentlyLooking = true
print("function2")
local Randomlook = math.random(1,4)
PlayerLookAt()
task.wait(Randomlook)
CD1 = false
CurrentlyLooking = false
Order = Order - 1
end
end```