Choppy Tween, am i missing something?

I have made an explosion effect with the use of meshes and tweenservice, it works as intended however, it’s a bit choppy and i can’t really find what’s wrong with it. The smoke doesn’t trail off as intended and it just kind of cuts to the smoke at a smaller size growing bigger again then dissapears:

https://gyazo.com/97a0dbdd29509e1edff2f1ea1fcbda58

Here’s my code if you can catch anything out:

local respos = script.Parent.PrimaryPart.Position
local respawntime = 2
local num = 0
local tweenservice = game:GetService("TweenService")
local timing = false

local tweeninginfo0 = TweenInfo.new(
	
	1,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	1,
	false,
	0
	
)

local Cloud = {
	
	Size = Vector3.new(96, 72, 80);
	
}

local Cel = {
	
	Size = Vector3.new(99, 74, 82);
	
}

local Fire = {
	
	Size = Vector3.new(76, 56, 62);
	
}

local tweeninginfo1 = TweenInfo.new(
	
	.6,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.In,
	1,
	false,
	0
	
)

local fade = {
	
	Transparency = 1;
	
}

local firefade = {
	
	Transparency = 1;
	Size = Vector3.new(0,0,0);
	Color = Color3.fromRGB(163, 162, 165);
	
	}

local function Explode()
	local cloudfx = game.ReplicatedStorage.ExplodeFX:Clone()
	local cloudcel = cloudfx.CelCloud
	
	cloudfx.CloudFX.Size = Vector3.new(0,0,0)
	cloudcel.Size = Vector3.new(0.25,0.25,0.25)
	cloudfx.Fire1.Size =Vector3.new(0,0,0)
	cloudfx.Fire.Size = Vector3.new(0,0,0)
	cloudfx.Parent = game.Workspace
	
	local tween1 = tweenservice:Create(cloudfx.CloudFX, tweeninginfo0, Cloud)
	local tween2 = tweenservice:Create(cloudcel, tweeninginfo0, Cel)
	local tween3 = tweenservice:Create(cloudfx.Fire, tweeninginfo0, Fire)
	local tween4 = tweenservice:Create(cloudfx.Fire1, tweeninginfo0, Fire)
	
	cloudfx:SetPrimaryPartCFrame(CFrame.new(script.Parent.PrimaryPart.Position))
	script.Parent.PrimaryPart.Anchored = true
	
	tween1:Play()
	tween2:Play()
	tween3:Play()
	tween4:Play()
	
	local explosion = Instance.new("Explosion", script.Parent.PrimaryPart)
	explosion.Position = script.Parent.PrimaryPart.Position
	explosion.Visible = false
	explosion.DestroyJointRadiusPercent = 0
	explosion.BlastRadius = 50
	explosion.BlastPressure = 100000
	explosion.ExplosionType = "NoCraters"
	
	wait(1)
	
	local tweenB1 = tweenservice:Create(cloudfx.CloudFX, tweeninginfo1, fade)
	local tweenB2 = tweenservice:Create(cloudcel, tweeninginfo1, fade)
	local tweenB3 = tweenservice:Create(cloudfx.Fire, tweeninginfo1, firefade)
	local tweenB4 = tweenservice:Create(cloudfx.Fire1, tweeninginfo1, firefade)
	
	local explosion1 = Instance.new("Explosion", script.Parent.PrimaryPart)
	explosion1.Position = script.Parent.PrimaryPart.Position
	explosion1.Visible = false
	explosion1.DestroyJointRadiusPercent = 0
	explosion1.BlastRadius = 10
	explosion1.BlastPressure = 1000000
	explosion1.ExplosionType = "NoCraters"
	
	cloudfx.Fire.Material = "Concrete"
	cloudfx.Fire1.Material = "Concrete"
	script.Parent:SetPrimaryPartCFrame(CFrame.new(respos))
	script.Parent.PrimaryPart.Anchored = false
	tweenB1:Play()
	tweenB2:Play()
	tweenB3:Play()
	tweenB4:Play()
	
	wait(.6)
	
	cloudfx:Destroy()
	explosion:Destroy()
	explosion1:Destroy()
end

script.Parent.PrimaryPart.ChildAdded:Connect(function()
	timing = true
end)

while wait(1) do
	if timing == true then
		num = num + 1
		
		if script.Parent.PrimaryPart:FindFirstChild("IsGrabbed") then
			num = 0
		end
		
		if num >= respawntime then
			Explode()
			num = 0
			timing = false
		end
	end
end

Tweens are naturally going to be choppy. You can use CFrames and lerp between each keyframe. CFrame | Documentation - Roblox Creator Hub

1 Like

I have figured out long ago that tweens sometimes tend to do this.
I have tried doing something of a simple explosion before, if the game/studio had more lag it would result in more choppy tweens.

Are you tweening meshparts or the mesh’s scale property?

I recommend using scale property of a mesh inside a part, it could also be that having to update the collision box every frame causes choppy tweens (uncollideable parts still have a collision box).

1 Like

You can also do this:

2 Likes

TweenService and lerp are relatively the same thing. The only real difference is that for TweenService, you’re allowing the engine to handle the heavy lifting for you and EasingStyles help specify how the alpha is reached.

Tweens are only choppy on the server. Use the client and they should be fairly smooth.

2 Likes

Exactly. That’s what I was attempting to get at by linking that resource. @InternallyAmplified, the resource can seamlessly tween between the server and client. You barely have to set up anything.

1 Like

Relatively the same thing doesn’t mean that there isn’t a performance drop. Tweens require you to load in a library, create a TweenInfo object and then call the play method on it. Surely that’s more computationally heavy than doing foo.CFrame:Lerp(bar.CFrame,time).

1 Like

TweenService doesn’t drop performance though? That’s not the case whether it’s done from either the client or the server. The server will sometimes skip over intermediate frames as it has other tasks to handle but it doesn’t hit performance. A tween will run better from the client and clients should be handling visual effects anyway.

As for the creation of the aforementioned objects, that is highly negligible in terms of expense. There’s probably a bit more computation involved as per the type of easing you use, sure, but it is still a lerp in essence. You just don’t do the work yourself.