What is the correct way to tween a Model?

A few minutes ago, I tried tweening a model’s position by myself, but I failed and my script didn’t work. Can you guys give me an example script on how tweening a model’s position work?

6 Likes

You should tween the PrimaryPart, and make sure everything else is welded to the PrimaryPart.

6 Likes

What part should I set as the PrimaryPart?

3 Likes

It doesn’t necessarily matter, but I recommend you make it have at least a little sense. Like the middle of the model, the most important part to it, or the biggest.

3 Likes

Oh alright. Thank you so much!

3 Likes

Well, I just set a part as the PrimaryPart, and tweened it, but it doesn’t tween the whole model. It tweens the PrimaryPart only, not the model.

Code:

local TS = game:GetService("TweenService")


local part = script.Parent.TriggerPart -- Which is the part I set as a PrimaryPart


local TI = TweenInfo.new(5, Enum.EasingStyle.Linear )

local Goal = {}

Goal.Position = Vector3.new(-99.804, 9.455, 25.395)

local Tween = TS:Create( part, TI, Goal)

Tween:Play()
3 Likes

Did you weld all of the parts to it?

2 Likes

There are just 2 parts in the model ( Part1 and TriggerPart ), but if I weld Part1 to TriggerPart, TriggerPart won’t be in the position I want it to be in

1 Like

Don’t use welds. Use WeldConstraints. They will stay in the same place, but it will work the same. (they also just work better and are better in general)

1 Like

After I do this, are you sure the script should work?

2 Likes

Yes. I do it all the time. I promise it does work, and if it doesn’t, please let me know. I will do everything I can to fix it

3 Likes

It works, but the model goes to everywhere, not to the position I set. It goes up, down and everywhere randomly

2 Likes

Can you send a video? I don’t really understand, sorry.

1 Like

robloxapp-20230815-0337315.wmv (536.6 KB)
(im just testing ambush jumpscare

edit: nvm i have to go to sleep right now. i will check the answer tomorrow

1 Like

Can you show me the hierarchy and the properties of each WeldConstraint?

2 Likes

Sorry but I actually have to go to bed right now

I’ll send it tomorrow

3 Likes

That is okay, however, I do have school tomorrow. I’ll be able to help after that (around 5:00 PM CDT)

3 Likes

Okay, here are some notes.

I found out why it moves randomly, it is because the model parts weren’t anchored. I anchored them, and the problem was 50% fixed. When I tweened the PrimaryPart, the the whole model didn’t tween. The PrimaryPart is the part that tweened to the set position only, not the model.

1 Like

Instead of the PrimaryPart, maybe try tweening the model’s CFrame

1 Like

I’ll try.

[30lettersblahblahbalh]

1 Like