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

Why isn't Humanoid.MoveToFinished:Wait() working?

Asked by 2 years ago

Hello! So I've been bored and I've tried to make a basic Humanoid:MoveTo() script which disables player's controls when the player's character is spawning and when Humanoid.MoveToFinished event fires the controls are back with the player.

SCRIPT:

game.Players.PlayerAdded:Connect(function(player)
    task.wait()
    player.CharacterAdded:Connect(function(char)
        char.Humanoid:MoveTo(game.Workspace.Part.Position)
        game.ReplicatedStorage.DisableControls:FireClient(player, "0")
        task.wait()
        char.Humanoid.MoveToFinished:Wait()
        print("Move to finished")
        game.ReplicatedStorage.DisableControls:FireClient(player, "1")
    end)
end)

When the player finishes walking to the point set in Humanoid:MoveTo() he obviously stops moving, but I don't see "Move to finished" message on output and my controls aren't back yet.

Basically the script is stuck on MoveToFinished and the stuff after the line with MoveToFinish isn't executing.

Answer this question