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

How to have a part move from one place to another?

Asked by 7 years ago

So I was watching a few videos on how to make a script to make an object go up and down and one going from left to right but to no avail they would end up glitching or not doing anything or just completely misbehaving. Would someone mind helping me please.

Here is the set up I have then I will show you the script I used last. So one object above is called Part1 and an object below is called Part2 and the object that needs to be moving when the game starts is called MovingPart. Also they are grouped together and the group is called Moving. So once the game starts Moving part is supposed to fuse into the part that I set it to in the script in this case I chose Part1. Then from there it goes to Part2. Then in the code was added while true do so I can make it last forever. The problem is this one does nothing when the game starts. Please help here is the script:

local bodyposition = script.Parent.MovingPart.BodyPosition
local p1 = script.Parent.Point1
local p2 = script.Parent.Point2

bodyposition.Position = p1.Position

while true do
    wait(3)
    bodyposition.Position = p1.Position
    wait(3)
    bodyposition.Position = p2.Position
end

1 answer

Log in to vote
0
Answered by 7 years ago

There are 2 ways you can go about this; 1. script.Parent.MovingPart.Position = Vector.new() {Put your desired coordinates in here} This is useful for moving a part to a fixed point 2. script.Parent.MovingPart.Position = game.Workspace.{Put the desired object to teleport to here} This useful for moving to an object

Hope I could help! : ^ )

0
So say I use the first one. Where would it go in the script? Then say can I make it wait and then put the the same wording in but going back the other way to another location. Sorry if this seems like a noobish question I am new to scripting and trying to figure it out. nightcrawl47 2 — 7y
0
Oh sorry, I answered this wrong, the way you want to do this. Ok so, you might wanna make sure that the part is not attached to the baseplate, because the baseplate is anchored and the part will be stuck. Next, you wanna make sure that the part itself isn't anchored. ventrixion 27 — 7y
0
So do I try and do what you just said and keep the script the same or should I change it around? nightcrawl47 2 — 7y
Ad

Answer this question