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

:MoveTo() function isn't working?

Asked by 9 years ago

Hello! I am making a game, and I am trying to test :MoveTo().

script.Parent.CarCover:MoveTo(-85.1, -0.8, 346.2)

Literally nothing happens. Yes, "script.Parent.CarCover" does exist and is a model. Nothing moves. CarCover does have a PrimaryPart. Does the anchored value matter in this case?

0
I would give you more details, but I don't have any. UnityAlex 36 — 9y
0
Are you sure this is happening (e.g., with a `print` immediately after)? Are you sure the script isn't starting before the model loads? Where was the model before the :MoveTo? BlueTaslem 18071 — 9y
0
Thanks guys... I feel really stupid now because I knew that. UnityAlex 36 — 9y

2 answers

Log in to vote
1
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
9 years ago

Problem

First off, it would help if you provided us an error with the script if there was one present. However, I was able to pick up on the issue fairly easily. You never used a Vector3 Value for the :MoveTo() function. Thus leaving the script to error stating the argument was invalid.


Solution

All you have to do is put the numbers you provided with your script into the parenthesis of Vector3.new()

script.Parent.CarCover:MoveTo(Vector3.new(-85.1, -0.8, 346.2))

If this answer did not help, please post any error you may be receiving from Developer Console or Output. This would help us greatly in solving your problem.

Hopefully this answer helped, if it did hit that upvote button. If this answered your question please hit Accept Answer to the right. If you have any questions, leave them in the comments below and I will get back to you.
0
hey remember when i was first but your answer was correctly bolded using some admin stuff yet you still got accepted? bartekrabit 38 — 6y
0
It's not my fault the asker chose my answer over yours. I just did some formatting on my answer which anyone can do. Try stackedit.io to see what your questions/answers look like in markdown or use the site preview function when asking questions. M39a9am3R 3210 — 6y
Ad
Log in to vote
0
Answered by 9 years ago

****Note****

This function does work, just it is Vector3 missing

****Solution****

script.Parent.CarCover:MoveTo(Vector3.new(-85.1, -0.8, 346.2)

If it dosen't work then try another Awnsers.

Answer this question