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

What should i use to move a part from one place to another?

Asked by 6 years ago

want to move a model to a part and the duration it will take to get to where the part i want to move is about 1 minute. I'm debating on if I should use Tweening or BodyPosition.

What I want to move is a spaceship and it has to go from one planet to another. So far here's my code:

local MainMenu = script.Parent.Parent.Parent.Menu
script.Parent.Changed:Connect(function()
    if script.Parent.Value == true then
        local ShipDrive = Instance.new("BodyPosition", script.Parent.SendWhatShip.Value)
        --Need to figure out how I can set what time it wil take to get the the start to the end.
        ShipDrive.Position = script.Parent.PlanetDestination.Value.Position
        script.Parent.SendWhatShip.Value.Parent = workspace
        if script.Parent.ReasonForTravel.Value == "Ally" then
            ShipDrive.ReachedTarget:Connect(function()
                MainMenu.AllyWithPlanet.Visible = true
                MainMenu.AllyWithPlanet.YesButton.MouseButton1Click:Connect(function()
                    script.Parent.SendWhatShip.Value.Parent = script.Parent.Parent
                    script.Parent.SendWhatShip.Value.Position = script.Parent.Parent.Parent.Parent.MenuWithSlot.Value.Position
                end)
            end)
        end
    else
        print("Send Ship Information Reset")
        script.Parent.PlanetDestination.Value = nil
        script.Parent.ReasonForTravel.Value = ""
        script.Parent.SendWhatShip.Value = nil
    end
end)

Notice that I also need to make the time it would take to get from the start position, to the end. (1:50 would be the duration) I also need the model to be pointing at its destination. (Also, don't worry about the other stuff in there, most of it is kinda irrelevant. All I need u to focus on is how i can move the model to one place to the other)

Thank you! If you need anything else, please comment what is needed.

0
To move a model, you would use MoveTo() Axceed_Xlr 380 — 6y
0
@Axceed_Xlr isn't :MoveTo() for models with humanoids? Chez_Guy 67 — 6y
0
@Chez_Guy not necessarily. You can use MoveTo() if you have a Primary Part of the model. basically you just select one part of the model to be your primary part, call that, then use MoveTo MusicalDisplay 173 — 6y

Answer this question