Heres the code :
local frame = script.Parent.Parent.Parent.Parent.SettingsFrame
script.Parent.Activated:Connect(function()
if frame.Visible == false then
frame.Visible = true
script.Parent.TextColor3 = Color3.fromRGB(0,0,0)
script.Parent.Parent.BackgroundColor3 = Color3.fromRGB(255,255,255)
local tweeninfo = TweenInfo.new(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local tween = game.TweenService:Create(frame,tweeninfo,{Size = UDim2.new(0.197, 0,0.575, 0)})
tween:Play()
else
script.Parent.TextColor3 = Color3.fromRGB(255,255,255)
script.Parent.Parent.BackgroundColor3 = Color3.fromRGB(0,0,0)
local tweeninfo = TweenInfo.new(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local tween = game.TweenService:Create(frame,tweeninfo,{Size = UDim2.new(0,0,0,0)})
tween:Play()
tween.Completed:Connect(function()frame.Visible =false end)
end
end)
When I open the GUI it causes immense lag and spikes my Send packets which lags my wi-fi. The GUI is a basic settings UI. I have a high end laptop too.

5 comments
This also happens while scrolling through it.
If it lags while scrolling, i think it might just be what you have on the gui or a different script. that script looks fine. Might lag less if its a local script but it shouldn't be that noticeable. Are there any other scripts that use up a lot of memory in the console or you just have a lot on the ui?
It definitely could be the event is activating too much, or like bullet said, other scripts might be on a never ending loop
Its on activate.
Well the lag is fixed somehow. But the ping still spikes up to 1 megabyte send