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

How would I move a model using TweenService?

Asked by 4 years ago
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.

0
Tween the model's CFrame. DeceptiveCaster 3761 — 4y
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. ConnorThomp 87 — 4y
0
Oh, in that case.. Make the model have a primary part, then tween the primary part ISeeChase2 14 — 4y
0
use lerp TheluaBanana 946 — 4y
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](http://) Arkrei 389 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

you can use:

model:SetPrimaryPartPosition(cframe)

or

model:MoveTo(vector3)

Ad

Answer this question