Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Issue with Humanoid.MoveToFinished not firing on time?

Asked by 5 years ago

Hi. So, I've only had this issue recently, where an NPC stays still after moving to a position, the script seemingly halting and refusing to proceed or even print the debug phrase despite the NPC clearly at the position it was told to move to. This was not an issue during early development of the game, but somehow is now.

local Step1 = game.Workspace.bricc1.Position
Humanoid:MoveTo(Step1)
Humanoid.MoveToFinished:Wait(.1)
print("oh lawd he shooting!!!")
Humanoid.Parent.Shoot.Disabled = false --Toggles the Shooting Animation
Sounds.Laugh:Play()
wait(3)
Humanoid.Jump = true
wait(1)
Humanoid.Parent.Shoot.Disabled = false
wait(3)

Is there a way I can optimize this, or is there lag I must get rid of within to server to fix the problem? This is also only a snippet of the entire script, the second instance using MoveTo (which occurs later in the script) has already been chained to a function. I have tried optimizing many bad scripts already elsewhere, but this issue still persists. If it would help and you need me to post the entire script, let me know so that I may edit it accordingly.

0
I have the same problem as well. My theory is that it has a cooldown, I think the first time you call it, it works however the second time i think it delays for certain reasons. As to why i have no idea. Mr_Pure 129 — 5y
0
Ok, so i've done some testing and i had a function that every 10 seconds makes the humanoid walk 10 studs forward. Then i used a pcall and used movetofinished function inside of that and printed in the output. but everytime it printed it printed one more time at a time for example OUTPUT: 1, 3, 6, 10, 15, 21, 28 ECT. i don't know what's causing this however. Mr_Pure 129 — 5y

Answer this question