I need a script for translateby and a button so that I can get a model to move left or right then stop. Then click the button again to move back to home position?
COMMUNITY QUESTION
Translateby with a button?
1 answer
You can use a for loop for this, for example;
local model=game.Workspace.Model
local part=game.Workspace.Part
part.ClickDetector.MouseClick:connect(function(pwc)
for i=1,10 do
model:TranslateBy(Vector3.new(0, 0.1, 0)
wait(0.1)
end
end)
this will make the model move up 1 stud in 1 second by 1 tenth of a stud per 1 tenth of a second.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
I have the model and then a button with a click detector off to the side with this code in it. What would I do from there?
I didn't give you the code to use in it, I gave you advice on how you could do it. But I wil change my answer to the script you would need.
Now you can just put that in the script and make sure the part w/ the clickdetector is named 'Part' and the model is named 'Model'.