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

Can't remember how to move a model, help?

Asked by 6 years ago

I know I know how to do this, it's just been forever sine I've programmed using roblox and I can't for the life of me remember how to do it. I need to move a model to another parts position, but for some reason it wont work.

local dwell = game.ReplicatedStorage.enemies["Dungeon Dweller"]

local enemy = dwell:Clone()
enemy.Parent = game.Workspace
enemy:MoveTo(Vector3.new(script.Parent.Position))

(script is located in the part I'm trying to move the model to)

If I include "Vector3.new", it just moves to model to the position (0,0,0) with no errors. If I remove "Vector3.new", it just clones the model to workspace but doesn't move it at all from its preset position in workspace (again, no errors).

0
postion is a vector 3 abnotaddable 920 — 6y

2 answers

Log in to vote
0
Answered by
Tomstah 401 Moderation Voter
6 years ago

enemy:MoveTo(Vector3.new(script.Parent.Position))

Here's your problem, you're making a Vector3, with a Vector 3. Position provides a Vector3.

If you're needing more, tell us. But I'm also somewhat sure that :MoveTo() is a method of a humanoid, not a model, so make sure on that. If you need to instantly move a model, look into :SetPrimaryPartCFrame()

0
MoveTo is a function of the Humanoid and Models. User#20476 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Did you mean a moving platform?

local bp = Instance.new("BodyPosition")
local bg = Instance.new("BodyGyro")

bp.Parent = script.Parent
bg.Parent = script.Parent

local mainmodel = game.Workspace.mymodel
local platform = mainmodel.movingplatform --change platform location
local start = mainmodel.start --change start location
local finish = mainmodel.finish --change finish location
local bodypos = platform.BodyPosition
local pos1 = start.Position
local pos2 = finish.Position
local waittime=0.5

local currentpos = pos1
while wait(waittime) do --loop starts, you can remove it if you want to remove
    if currentpos == pos1 then
        currentpos = pos2
        wait (waittime)
        bodypos.Position = pos2
    else
        if currentpos == pos2 then
            currentpos = pos1
            wait(waittime)
            bodypos.Position = pos1
        end
    end
end --loop ends

Answer this question