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

Is there any way to make a model not fall without anchoring?

Asked by 4 years ago

Hello im making a elevator and it has welds, but i dont want it to fall, how can i prevent it from falling without removing the welds or using anchoring it?

0
any specific reason why you want to avoid anchoring megukoo 877 — 4y
0
i want to move it with tween service and i dont know how to use it in models maumaumaumaumaumua 628 — 4y
0
i'm pretty sure TweenService still works with anchored parts, you may have to create a manual tweening method though megukoo 877 — 4y
0
but how can i use it with a entire model maumaumaumaumaumua 628 — 4y
View all comments (2 more)
0
want me to write an example as an answer? megukoo 877 — 4y
0
ok maumaumaumaumaumua 628 — 4y

1 answer

Log in to vote
0
Answered by
megukoo 877 Moderation Voter
4 years ago

Following up from the comments,

You can tween a model using for loops and SetPrimaryPartCFrame(). Note that you'll need a primary part for this to work.

Setting the CFrame directly will also ignore objects/terrain in the way of the position, but this will move the entire model with or without welds.

local model = workspace.Model -- assume model
local goalBrick = workspace.Goal -- assume part
-- example

function tweenModel(model, goal)
    -- tweens the model to the goal
    local start = model.PrimaryPart.Crame
    local step = 1 -- the higher this is, the faster it'll go
    for i = 0, 100, step do
        local newCF = start:Lerp(goal, i/100)
        -- CFrame:Lerp(goal, alpha) creates a CFrame that is interpolated between start and goal by alpha. (i.e) if alpha is 0.5, the returned CFrame will be 50% of the way between start and goal
        model:SetPrimaryPartCFrame(newCF) 
        wait(0.1)
    end
end

tweenModel(model, goalBrick.CFrame)
Ad

Answer this question