I posted a question earlier. I figured out why the script stopped working but now there is a new problem. Thankfully, with the previous one (the link below), the only problem was apparently me forgetting a few ends, and the example will not need a link to it.
https://scriptinghelpers.org/questions/95225/how-do-i-fix-my-npcs-schedule-script
I am trying to make the script like a schedule. Throughout the schedule, I realized a single problem... The code below is a small chunk however what happens is obvious...
When the code runs, it loops the if statement below, and once that loop is over, it will check the time to do the next thing. I am trying to break that loop since it falls on the waits. I want to break the loop out of the wait when the next time frame/activity comes around, instead of the NPC going to the task it was supposed to have done or even skipping tasks based on the time.
I tried using elseif instead of if to see if that would fix the problem, but it does not seem to have worked.
if game.Lighting.ClockTime > 19 or game.Lighting.ClockTime < 5 then
NPC.Humanoid.Sit = false
wait(.1)
NPC:MoveTo(script.Parent.Spawn.Position)
NPC.Humanoid:MoveTo(script.Parent.Bed.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(100)
elseif game.Lighting.ClockTime > 5 and game.Lighting.ClockTime < 6 then
--Beginning of day (5:00)
NPC.Humanoid.Sit = false
NPC.Humanoid:MoveTo(script.Parent.OutsideofRoom.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(0)
NPC.Humanoid:MoveTo(script.Parent.TopofStairs.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(0)
NPC.Humanoid:MoveTo(script.Parent.BottomofStairs.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(0)
NPC.Humanoid:MoveTo(script.Parent.OutsideReceptionRoom.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(0)
NPC.Humanoid:MoveTo(script.Parent.OutsideBathroom.Position)
NPC.Humanoid.MoveToFinished:wait()
wait(0)
NPC.Humanoid:MoveTo(script.Parent.InsideBathroom.Position)
NPC.Humanoid.MoveToFinished:wait()

1 comment
I don't quite understand your problem.