Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to Make a Multi-Point MoveTo "Cutscene" Script? [UNSOLVED]

As of now, I've been using multiple scripts to deal with my cutscenes, and I'm quickly finding it's slowing things down. Let's say that, for instance, we had these lines --

game.Players.LocalPlayer.Character.Humanoid:MoveTo(Vector3.new(1, 2, 3))
-- wait until player reaches above point
game.Players.LocalPlayer.Character.Humanoid:MoveTo(Vector3.new(2, 2, 4))

The full script is inside of a LocalScript in a GUI inside of the player.

I can think of a couple things that might be able to make it multi-point:

  • Add a wait(X) afterwards for the specific time to each point

    • I'm just worried that lag may effect the time taken. It would also be extremely time-consuming for each script.
  • Some sort of check between the WalkToPointand TargetPoint properties.

    • The problem here is I have no idea if this would work, and have trouble trying to find out since there's so little documentation on both of these.
      • I'd expect this would need to be used with an if or repeat until.

I would like to avoid any use of a Touchedfunction with hit, since that will make the GUI method somewhat redundant and hard to use, make nil inputs a huge pain, et cetera.

Thank you for reading, and I hope to find a solution to the problem

EDITED --

local lplayer = game.Players.LocalPlayer.Character.Humanoid

lplayer:MoveTo(Vector3.new(-184.3, 751.101, 1.9)) print("Move1") -- Print displays
repeat wait() until game.Players.LocalPlayer.Character.Torso.Position == Vector3.new(-184.3, 751.101, 1.9)

lplayer:MoveTo(Vector3.new(-169.5, 751.101, 0.9)) print("Torso == 1") -- Print does NOT display
repeat wait() until game.Players.LocalPlayer.Character.Torso.Position == Vector3.new(-169.5, 751.101, 0.9)

1 answer

Try using a repeat loop to wait until the Torso's Position property in the player's character is equal to the Vector3 you want the character to move to. That's what I used to create a short little sequence based on a TV series I've been getting into called "Person Of Interest".

Example:

repeat wait() until game.Players.LocalPlayer.Character.Torso.Position == Vector3.new(1,2,3) --Just an example Vector3, change as needed.

3 comments

0

I'm still having some issues using this code. I've got the lines I'm currently working with now edited into the post. It's taking me to the first point, slightly changing direction, and keeps moving.

0

You didn't change the Vector3 on line 7 to the one on line 6.

0

Oh, I've not even bothered getting to that. Since I can't even get past the first wait(), I've kind of neglected that. I'll change that, but the code after the first wait() still fails to function.

This discussion is preserved as it was. New answers, comments, and votes are closed.