TweenService triangle animating issues

Hello!
I have a problem with tweenservice.

My goal is to animate the triangle to make it go up and down (around 1 stud) and rotate around Y axis 360 degrees.

Here’s a screenshot of what the triangle looks like (prim is primarypart):


(Yes I know, using WeldConstraints is more effective however I’ve tried using both and it brought the same results)

However, there are a few problems…

  • Welds and WeldConstraints only weld parts together when I tween CFrame (which is so stupid in my opinion)
  • I cannot tween everything in one tween, i need to have different properties for each one
  • Tweening Angles and CFrame at the same time causes even more issues (parts glitching, going under map etc.)
  • Tweening a property twice causes the previous tween to stop, so I cannot tween 2 CFrame's

Would anyone help me? I am literally struggling with it for 2 hours…

Currently, this is my code but it doesn't work at all. I am posting it so it might be easier for anyone to understand what I want to achieve more specifically.
-- animations

local ts = game:GetService("TweenService");
local prim = script.Parent.PrimaryPart;

local disshape = false;

local rad = math.rad;

ts:Create(prim,TweenInfo.new(1.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true,0),{Position = prim.Position + Vector3.new(0,1,0)}):Play();
ts:Create(prim,TweenInfo.new(4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,false,0),{CFrame = prim.CFrame * CFrame.Angles(0,rad(360),0)}):Play();

And no. I won’t use blender to make a triangle and convert this model into a meshpart.
Because…

  • I want to have some more animations with these 4 parts inside of a model
  • I am noob at blender and these shortcuts and all are getting me mad even more
  • I don’t want to learn it cause I am not a builder. I am building occasionally

I’ve been searching for the solution on devhub (mainly welds and cframe tutorials) and devforum, but unfortunately I found nothing.

Thanks, have a nice day!

2 Likes

If it is a model then you can tween the primary part and set the primary part. This means that you can do away with having multiple tweens and keep it as a whole model.

I would create a invisible non collide box around it and use that as the primary part. Then when tweening just use Model:SetPrimaryPartCFrame(NewPosFromTween).

Also if all its doing is rotating you could even just do it on 2 loop cycles, one going up and one going down.

1 Like

That’s actually smart!

But how would I use Model:SetPrimaryPartCFrame in a tween?

where you normally just set the CF of the individual part, just make it change the models CF instead of the parts.

I’ve also found that you are trying to play two tweens at once when they could be combined

CFrame has a position property, so you can do the rotation and the position changes in one.

ts:Create(prim,TweenInfo.new(4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,false,0),{CFrame = prim.CFrame + CFrame.new(0,1,0) * CFrame.Angles(0,rad(360),0)} ):Play();

It looks as though you are already changing the models CF. So its doing the same thing by the looks of it.

But SetPrimaryPartCFrame is a function… so I don’t think that I can do something like

ts:Create(model.PrimaryPart,tweeninfo,{model:SetPrimaryPartCFrame = CFrame.new(...)}):Play()

Edit: nvm

I don’t think it would work this way. As it is a function that directly sets the CF. if you were lerping it then it would be fine.

But it looks like your were already changing the primary parts CF anyway


That’s what happens now

With this code:

-- animations

local ts = game:GetService("TweenService");
local prim = script.Parent.PrimaryPart;

local disshape = false;

local rad = math.rad;

ts:Create(prim,TweenInfo.new(1.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,-1,true,0),{Position = prim.Position + Vector3.new(0,1,0)}):Play();
ts:Create(prim,TweenInfo.new(4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,false,0),{Orientation = Vector3.new(0,360,0)}):Play();

And this hierarchy:
obraz

The triangle falls down for an unknown reason… But it keeps spinning.
The “prim” part seems to be spinning exactly as intended

The triangle needs to be anchored if you want it to float.
So weld the invisible box to the other parts and anchor the invisible box.

When I weld the box the triangle doesn’t do anything.
I have already welded the box to the other parts

hmm.
One thing I’ve just picked up in is the name “Triangle Enemy”.
You could of just used the animation editor and made animations so much quicker.

I’m not sure how to make them all stay together how it is though.

1 Like

Well, as I stated…

So I would need to tween everything in a CFrame.
However

Also, I think that I’d use the animation editor though…
It seems like an easier alternative for me. The model itself would still need to have the Humanoid, cause it will be moving.

Anyways, thank you so much for your help and patience!

Have a nice day!