How to make tween animation not laggy when playing ingame

when playing the tweenparts inside studio when running the game its smooth but when playtest it lags and stutter, any help?
heres the script

local TS = game:GetService("TweenService")
local TA = TweenInfo.new(5,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
local a = script.Parent
while true do
	wait(30)
	local t1 = TS:Create(a.WP1,TA,{Position = Vector3.new(-297.5, -14.8, -271.5)})
	t1:Play()
	local t2 = TS:Create(a.WP2,TA,{Position = Vector3.new(298.5, -14.8, 272.5)})
	t2:Play()
	local t3 = TS:Create(a.WP3,TA,{Position = Vector3.new(271.5, -14.8, -297.5)})
	t3:Play()
	local t4 = TS:Create(a.WP4,TA,{Position = Vector3.new(-270.5, -14.8, 298.5)})
	t4:Play()
	wait(30)
	local t1a = TS:Create(a.WP1,TA,{Position = Vector3.new(-297.5, -14.8, 272.5)})
	t1a:Play()
	local t2a = TS:Create(a.WP2,TA,{Position = Vector3.new(298.5, -14.8, -271.5)})
	t2a:Play()
	local t3a = TS:Create(a.WP3,TA,{Position = Vector3.new(-270.5, -14.8, -297.5)})
	t3a:Play()
	local t4a = TS:Create(a.WP4,TA,{Position = Vector3.new(271.5, -14.8, 298.5)})
	t4a:Play()
end

Tweening on the server will always end up somewhat laggy depending on the speed at which you are tweening the property. If you’re looking for no lag whatsoever, handle tweening on the client.

3 Likes

how do you do that? sorry
do i have to change it to localscript? rather than normal script?

1 Like

Yeah, when people talk about the client they mean LocalScripts.

4 Likes