Problem with Tweening Models

I followed this tutorial (Introduction to Tweening Models) on how to tween models. I completed all the steps however it didn’t work as expected.

The root was tweening perfectly, but the rest of the model wasn’t following the root as intended, and was just stuck in place. Everything but the root was unanchored and everything was welded.

Would you mind providing video of workspace and video of the tween?

Is that really necessary? I feel as if I explained it enough. I’m heading to bed soon so I’ll probably do it tomorrow.

Just picture the model that is supposed to be tweening, not tweening. But the root is. If that makes any sense

That leaves me with no information, but I think I have an idea why it is happening, are you setting the welds properties? ECT Weld0, Weld1

did you weld it yourself or did you use a plugin? sometimes doing it manually can work out bad and since you havent given us any videos or code we cant do anything to help you.

I think you need welds to move tween parts in a model. I could be wrong though

I used a slightly modified version of the code in the tutorial I linked to automate the welding. Doing it manually would take forever.

local model = workspace.Model
local Part1 = model.PrimaryPart

for _, Part0 in pairs(model:GetDescendants()) do
	if Part0:IsA("BasePart") and not (Part0 == Part1) then
		local WeldConstraint = Instance.new("WeldConstraint")
		WeldConstraint.Part0 = Part0
		WeldConstraint.Part1 = Part1
		WeldConstraint.Parent = WeldConstraint.Part0
		
		Part0.Anchored = false
	end
end

Part1.Anchored = true
Part1.CanCollide = false

Something like that. So yes everything should be welded properly.

Heres a video:

And the script handling the tweens:

local TweenService = game:GetService("TweenService")

local model = workspace["M.D.S.E.U.P"]
local squillies = workspace.squillies:GetChildren()
local modelRoot = model.PrimaryPart

local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)

local function GoToSquilly(x, z)
	local nyoom = TweenService:Create(modelRoot, tweenInfo, {
		Position = Vector3.new(x, modelRoot.Position.Y, z)
	})
	
	local drop = TweenService:Create(modelRoot, tweenInfo, {
		Position = Vector3.new(0, modelRoot.Position.Y, 0)
	})

	nyoom:Play()
	nyoom.Completed:Wait()
	
	wait(3)
	
	drop:Play()
end

while true do
	wait(10)
	
	local randomSquilly = squillies[math.random(1, #squillies)]
	
	GoToSquilly(randomSquilly.Position.X, randomSquilly.Position.Z)
end

Apparently it wasn’t working because I was using Vector3 instead of CFrame. Got it to work now.

I feel like it might be useful to note why I chose to use CFrame in the tutorial and not position. I’ve noticed that a lot of problems regarding model movement for those who follow that tutorial stem from trying to modify the code and using position instead of CFrame. Welds don’t quite appreciate that.

Hi. i’m doing all of that in my script but still only the primarypart is moving. Why?

local ground = script.Ground.Value
local moving = script.Moving.Value
local model = script.Parent
local cent = model.PrimaryPart
local button = model.Stand.Button
local tws = game:GetService("TweenService")
local ti = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 1.5)

button.ClickDetector.MouseClick:Connect(function(plr)
	if moving == false then
		if ground == true then
			moving = true
			local t = tws:Create(cent, ti, {CFrame = cent.CFrame * CFrame.new(0, 18, 0)})
			t:Play()
			wait(6.5)
			ground = false
			moving = false
		elseif ground == false then
			moving = true
			local t = tws:Create(cent, ti, {CFrame = cent.CFrame * CFrame.new(0, -18, 0)})
			t:Play()
			wait(6.5)
			ground = true
			moving = false
		end
	end
end)

If you’re using the weld method, make sure your parts aren’t joined to other surfaces or that they aren’t anchored. You will actually need to show a file or screenshots of the model, properties and relevant hierarchies - the code here is fine as far as I can see.

That being said: you can also use pivots instead to move your model around and I would recommend that instead as well.

1 Like

yeah i just looped thru the model and tweened each part which worked

1 Like