Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I move a model using TweenService?

local StartCF = DoorModel.PrimaryPart.CFrame

local function OpenGate()
    for i = 1, 50 do
        DoorModel:SetPrimaryPartCFrame(StartCF:lerp(StartCF * CFrame.Angles(-math.rad(0),-30,0), i*0.0225))
        wait()
    end
end

local function CloseGate()
    local NewCF = DoorModel.PrimaryPart.CFrame
    for i = 1, 50 do
        DoorModel:SetPrimaryPartCFrame(NewCF:lerp(StartCF, i*0.02))
        wait()
    end
end

This is the code in which I am already using to move my model, but it looks very "jumpy" due to the fact it uses CFrame and not TweenService.

I have tried to manipulate the above code to work using TweenService, but I can't seem to achieve it.

5 comments

0

Tween the model's CFrame.

0

The video shows how to Tween a single part, I am wanting to Tween an entire model. Again, I could try manipulate the code to make it work, but I have already attempted to do that and failed.

0

Oh, in that case.. Make the model have a primary part, then tween the primary part

0

use lerp

0

You Could use Mode:MoveTo, it moves an entire model to a vector3 position, you can find more abotu it here https://developer.roblox.com/api-reference/function/Model/MoveTo

1 answer

✓ Accepted answer

you can use:

model:SetPrimaryPartPosition(cframe)

or

model:MoveTo(vector3)

This discussion is preserved as it was. New answers, comments, and votes are closed.