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

How can i make a script the moves the part when it is clicked?

Asked by
KelcriC -1
5 years ago

Here is my code, but i don't know whats wrong

Part = script.Parent.Parent

Part.ClickDetector.MouseClick:Connect(function() Part:moveto(Vector3.new(10,12,11)

wait(10) Part:movetod(Vector3.new(10,10,10)

)

end)

0
wiki.roblox.com INOOBE_YT 387 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Not sure how your script is set up since it doesn't appear that you added it as a code block right so here's my best shot.

First, if this is your script (as shown on your post):

Part = script.Parent.Parent

Part.ClickDetector.MouseClick:Connect(function()

Part:moveto(Vector3.new(10,12,11)

wait(10)

Part:movetod(Vector3.new(10,10,10))
end)

Here are two things to take into account: 1. Make sure that the Part is actually "script.Parent.Parent". If the script is actually just in the part then it should be "script.Parent" 2. Make sure that when you use "moveto()" it isn't "movetod()"

If you have any questions or issues, please contact me. ;)

Ad

Answer this question