Problem with :MoveTo

Hello, Roblox community! Today I have a problem with :MoveTo, Here is my script (It’s a local script in the PlayerGui) :


MoveTo = a part

The Output : attempt to index function with ‘Position’

Use this code


The character is just a model so you can’t move it via a script.
You need to move the model's PrimaryPart

I have the same problem with the PrimaryPart :confused:
attempt to index function with ‘Position’

Is Example a model?

If so, what lua is doing is actually accessing the MoveTo method (the same one you’re firing on the character!) – It is possible to access functions with . instead of : (but this causes adverse effects and you shouldn’t do it.

Try altering your code to this:

Placing the object in ["brackets and quotes"] tells it to look for an object with that name. (Edit: This is false.)

It also allows you to get objects that have spaces or periods in their name.

1 Like

is MoveTo a child?
Also is MoveTo a model?

I have the same problem : attempt to index function with ‘Position’

I said MoveTo is a part [30Char]

Then change it to :FindFirstChild("MoveTo"). The bracket method actually accesses functions as well. My mistake. Hadn’t realized that.


put that local script inside startercharacterscripts

Thank you very much! You’re a great person!