Explosion effect doesn't tween as it should

Hello Developers!

I’m still perfecting the explosive objects, and I’m having some problems with them.

Basically, I’m working on the explosion effect. I want the exploding object to move in the air, then fall to the ground after the explosion event.

After being tweened into the air, the object simply rotates in a strange way.

Video: (Ignore the broken tool)

Tween up code:

game:GetService("TweenService"):Create(script.Parent.Barrel, TweenInfo.new(0.5),{CFrame = CFrame.new(script.Parent.Barrel.CFrame.Position + Vector3.new(0,3,0))}):Play()

Tween down code:

game:GetService("TweenService"):Create(script.Parent.Barrel, TweenInfo.new(0.5),{CFrame = CFrame.new(script.Parent.Barrel.CFrame.Position - Vector3.new(0,3,0))}):Play()

The exploding object is an Union. Could this be a problem?

1 Like

You have to modify the CFrame, not just the position.

Change your up tween to this:

game:GetService("TweenService"):Create(script.Parent.Barrel, TweenInfo.new(0.5),{CFrame = CFrame.new(script.Parent.Barrel.CFrame+ Vector3.new(0,3,0))}):Play()

And your down tween to this:

game:GetService("TweenService"):Create(script.Parent.Barrel, TweenInfo.new(0.5),{CFrame = CFrame.new(script.Parent.Barrel.CFrame - Vector3.new(0,3,0))}):Play()