Lag from a simple tween

I was trying to make a Jojo’s bizarre adventure time stop effect for my game with the shockwave effect but when it plays it drops my fps.

I want my tweens to be as smooth as possible.

The issue is there are huge lag spikes every time the tween plays and I have tried many things but never got the lag fixed.

I tried playing the tween on clients instead of the server but there it is still choppy like it was before

here is the script

game.Lighting.TimeStopEffect.TsWave.OnClientEvent:Connect(function(TsEffect)
	local TweenService = game:GetService("TweenService")
	local Info = TweenInfo.new(
		1, 
		Enum.EasingStyle.Linear

	)
	local propities = {
		Size = Vector3.new(100, 100, 100)
	}
	local tween = TweenService:Create(TsEffect, Info, propities)
	tween:Play()
end)

game.Lighting.TimeStopEffect.TsWaveEnd.OnClientEvent:Connect(function(TsEffect)
	local TweenService = game:GetService("TweenService")
	local Info = TweenInfo.new(
		1, 
		Enum.EasingStyle.Linear

	)
	local propities = {
		Size = Vector3.new(0.7, 0.7, 0.7)
	}
	local tween = TweenService:Create(TsEffect, Info, propities)
	tween:Play()
end)
1 Like

Nothing to do about it. Maybe remove some parts from it. Have no Idea.

it is just tweening a single part so I don’t think that’s the problem.

Not sure, maybe the problem is your ping? Not sure really.

I don’t think that’s the problem as I have pretty decent ping

One thing you can do is use external modules like boatbomber’s BoatTween module and see if that fixes the lag.

2 Likes

I think that module just helps setting up tweens so I don’t think it will fix the problem but i might give it a try

You didn’t set the EasingDirection, don’t know if that’d change anything

i’m pretty sure that won’t fix alot of the lag

How many times is the event getting fired?

once when the time stop is activated

Can I see the code for the timestop

1 Like
script.Parent.TimeStop2:Play()
		wait(2)
		
		local TsEffect = game.Workspace.Effects.TS:Clone()
		TsEffect.Parent = game.Workspace
		TsEffect.Position = plr.Character.HumanoidRootPart.Position
		game.Lighting.TimeStopEffect.TsWave:FireAllClients(TsEffect)
		local TweenService = game:GetService("TweenService")
		local Info = TweenInfo.new(
			1, 
			Enum.EasingStyle.Linear
			
		)
		local propities = {
			Size = Vector3.new(100, 100, 100)
		}
		local tween = TweenService:Create(TsEffect, Info, propities)
	
		game.Lighting.TimeStopEffect.Enabled = true
		local children = game.Players:GetChildren()
		for i = 1, #children do
			local child = children[i]
			if child:IsA("Player") then
				local children = child.Character:GetDescendants()
				for i = 1, #children do
					local child2 = children[i]
					if child2:IsA("Part") then
						child2.Anchored = true
					end
				end
			end
		end
		wait(0.2)
		local children = plr.Character:GetDescendants()
		for i = 1, #children do
			local child = children[i]
			if child:IsA("Part") then
				child.Anchored = false
			end
		end
		wait(5)
		local propities = {
			Size = Vector3.new(0.7, 0.7, 0.7)
		}
		game.Lighting.TimeStopEffect.TsWaveEnd:FireAllClients(TsEffect)
		local tween = TweenService:Create(TsEffect, Info, propities)
		
		script.Parent.ResumeTime:Play()
		wait(1)
        TsEffect:Destroy()
		game.Lighting.TimeStopEffect.Enabled = false
		local children = game.Players:GetChildren()
		for i = 1, #children do
			local child = children[i]
			if child:IsA("Player") then
				local children = child.Character:GetDescendants()
				for i = 1, #children do
					local child2 = children[i]
					if child2:IsA("Part") then
						child2.Anchored = false
					end
				end
			end
		end
		game.Lighting.TimeStopEffect.Enabled = false
		game.Workspace.TimeStopped.Value = false
		plr.tsbyplr.Value = false

dont think about the tween in that code as i accidently left it there but it aint playing so it shouldnt effect anything

Could be because the remote event get fired multiple times and the tween plays multiple times?

sometimes parts can lag if you have a humanoid in your workspace, do you have one sitting in you workspace?

3 Likes

Thanks this worked! I didn’t know I had a humanoid in workspace.