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

Why does this make the player walk to the wrong position?

Asked by
tumadrina 179
10 years ago

It moves the player to 0,0,0

while wait(5) do
Mouse=game.Players.LocalPlayer:GetMouse()
print(Mouse.Origin.p)
Pos=Mouse.Origin.p
game.Players.LocalPlayer.Character.Humanoid.WalkToPoint=Vector3.new(pos)
end


1 answer

Log in to vote
2
Answered by
Scubadoo2 115
10 years ago

Two things

  1. in game.Players.LocalPlayer.Character.Humanoid.WalkToPoint=Vector3.new(pos) pos isn't capitalized, so it thinks it is another variable.

  2. Pos is already a Vector3, so you don't need it to be in a Vector3.new

You just need to change the line to game.Players.LocalPlayer.Character.Humanoid.WalkToPoint=Pos

Ad

Answer this question