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

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

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?

6 comments

0

any specific reason why you want to avoid anchoring

0

i want to move it with tween service and i dont know how to use it in models

0

i'm pretty sure TweenService still works with anchored parts, you may have to create a manual tweening method though

0

but how can i use it with a entire model

0

want me to write an example as an answer?

0

ok

1 answer

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)

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