I am trying to make a script that basically leads to you clicking a Model. Once the model is clicked it will move Left or if it was already left it would be Right, I tried going through the wiki but still having trouble. If you can please help me out. Thanks.
to do that, you would firstly need to know exactly between wich two coordinates a part of the model should move. we will base the script on that. only 1 of the 3 coordinates should be different.
you will probably need to do some adjustments, but imagine your part moves between (10,0,0) and (20,0,0). that would mean the X coordinate needs to change (coordinates are X,Y,Z) then you do this. i will make the script based on having a clickdetector.
-- i especially made this script for easy configuring. simply change the variables at the top to fit your part. if the Coordinate is Y or Z, only change Position.X at line 3 to Position.Y or Position.Z. just keep the variable X to spare yourself time. local speed = 0.07 -- how much the brick moves each tick local waittime = 0.25 --How much time there is between each tick. X = Workspace.Model.Part.Position.X -- make sure this is the brick you based coordinates on. minpos = 10 --Minimum position, this is 10 in this case maxpos = 20 --Maximum position, this is 20 in this case model = Workspace.Model --the model you want to move. function clicked() if X < maxpos then While X < maxpos do model:MoveTo(X + Vector3.new(speed,0,0)) X = X --Update the Variable if X > maxpos then x = maxpos --Check, to make sure it won't outpass its limit on the last tick. end wait(waittime) end else While X > minpos do model:MoveTo(X - Vector3.new(speed,0,0)) X = X -- update the variable. if X < minpos then x = minpos --Check, to make sure it won't outpass its limit on the last tick. end wait(waittime) end end Workspace.Model.Part.ClickDetector:connect(clicked) -- Clickdetectors can only be used in parts. so those wich brick should be clicked wisely
The way I would do it is to check it's cords, then if it's == to the last position then move it to the next.. If you need me to set up a base script for you then I will.