I am new to scripting and am trying to script it so where someone joins they are forced to move right and wont stop moving, therefore i looked for scripting guides and came up with this does anyone know why it doesn't work?
while wait() do wait(0.1) game.Players.PlayerName.Character:MoveTo(Vector3.new(0.06, 1, -454.194)) -- cordinates end
I have a few points I want to make:
First, you don't need 2 waits in your loop (you have one on line 1 and another one inside the loop). One's enough.
Second, you don't need a loop at all. If you just call :MoveTo()
, it will automatically make the character walk to a certain point without having you to manually recall that every time.
Third, you'll need to disable player control (is it done automatically? I can't remember). Otherwise, the player'll be able to try to fight back and go somewhere else. Again, if I'm wrong and the player can't control its movement, then you can ignore this.