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

Is Humanoid:MoveTo() Broken?

Asked by 10 years ago

I have a script which mimics the classic click-to-walk style of ROBLOX, but Humanoid:MoveTo() doesn't seem to work. m is PlayerMouse, p is player, h is Humanoid, g is just a random brick

print('Movement ' .. p.Name .. ' started.')
h:MoveTo(Vector3.new(m.Hit.X, m.Hit.Y, m.Hit.Z), g)

...which fires on-click. I am positive it's a problem with the Humanoid:MoveTo(), because everything else in the function works, including the print()

Is Humanoid:MoveTo() broken?

0
No, I've been playing around with a script recently that uses MoveTo() without a hitch. Could the problem be with g? I've only used Vector3 values for MoveTo() and don't know if it can take another value like that. deaththerapy 60 — 10y
0
Keep in mind, there are 2 different `:MoveTo()` methods: One as a method of a model, and one as a method of `Humanoid`. The second one requires any random Brick for the last parameter. bobberson12 0 — 10y

1 answer

Log in to vote
2
Answered by
TaslemGuy 211 Moderation Voter
10 years ago

No, it's not broken. Your problem is with m.Hit.X.

The X should actually be x. That is, the properties are lowercase, not uppercase. So the fix for your code is:

h:MoveTo(Vector3.new(m.Hit.x, m.Hit.y, m.Hit.z), g)

But the thing is, you don't need to do what you're doing.

Saying Vector3.new(m.Hit.x, m.Hit.y, m.Hit.z) is really just duplicating m.Hit.p, so replace it with that:

h:MoveTo(m.Hit.p , g)
0
I wish I had known the x, y, and z were lowercase when I attempted a anti spawn kill script. I posted on the scripting helpers forum trying a technique with position, and got very little useful help, they were trying to get me to do magnitudes... Anyways, you helped me so Upvote! M39a9am3R 3210 — 10y
0
Well, that *seems* like it would work, but I still have the same issue after switching to `h:MoveTo(m.Hit.p , g)`. bobberson12 0 — 10y
0
What seems to be the problem, exactly? Is it crashing? If so, what is the output? What is it doing instead? TaslemGuy 211 — 10y
0
What is it doing? Nothing. Absolutely nothing. No errors, nothing. bobberson12 0 — 10y
Ad

Answer this question