Tween not working on welded parts

I want to make a egg hatching system which displays the pet which has been hatched spin.

I welded all the parts of the pet to a hit box which I rotated using the tween service, which was displayed in a viewport frame. h
However, the welded parts are not spinning at all, the only thing that is is the hit box itself.

I tried searching the devforum for similar topics as well as bug reports, I did find something but it didn’t work either. I tried re-welding the model in different ways, however that didn’t work either.

Script:

local PetRotationTween = TweenService:Create(ChosenPetHitbox,TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,2.5), {CFrame = ChosenPetHitbox.CFrame * CFrame.Angles(0,math.rad(175),0)})
PetRotationTween:Play()

Welds:

7ea6f71a13761e61f541ae08c50444ef

Any sort of help is very much appreciated! :smiley:

Update: It works perfectly fine in the workspace but doesn’t work at all when placed in viewport frame.

1 Like

use lerp instead do model:SetPrimaryPartCFrame(primarypartCFrame,targetCFrame,number range from 0 - 1) and do it in a loop

1 Like

I am trying to change the orientation of the object, not its position.

yes you can change orientation with cframe just do CFrame.Angles()

2 Likes

Sorry, but please read the topic carefully, I am already changing the object’s orientation using CFrame.

1 Like

apparently you cannot do that with tween, try doing CFrame:lerp() to the primary part of the model specificly

1 Like

You’re telling me about an alternative, I am asking for a solution. :smiley:

4 Likes

here’s a solution sorry:

to achieve moving all parts you get all the offsets from primary part. you do tween to each of them and refresh the tween rapidly for the smoothly. this is the only solution i can think of to achieve that using tween

2 Likes

That’s not optimized at all, furthermore it would be impossible to tween all the objects at the same time. :confused:

:frowning: i am sorry i am very new at helping people but i also think you can use renderstepped to arrange the parts using offsets from the primary part, with so you can still do tween :frowning:

3 Likes

Thank you for your help though!

by the way i wonder if you anchored all the alternative parts, if so it wont follow your focused part to tween

Make sure only the Hitbox is anchored.

local main = workspace.Model.main
local ts = game:GetService("TweenService")
local tween = ts:Create(main, TweenInfo.new(5), {
	CFrame = CFrame.new(0,30,0)
})
tween:Play()
print("Playing")

image

2 Likes

Correct me if i’m wrong but when tweening parts you aren’t supposed to have the part that you are tweening anchored?

You should have the primary part anchored if you’re tweening its location. Otherwise the engine would just apply physics to it and it would just keep falling and not moving.

If you want physics to still apply to it properly, use a Body object to move it.

Here’s what happens if everything is anchored.

1 Like

I tried making the hit box anchored with everything else unanchored, but it still didn’t work.

My example shows it does. Please provide a small reproduction model so we can see what is specifically wrong with your model.

1 Like

The grey box is the hit box. I made it non-transparent so you can see it.

Sorry, I meant a model file we can put in a blank place to test with. You can remove any proprietary meshes if needed. Because if the code that I showed is working but not working for your particular model we need to dig a bit deeper.

1 Like