Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Insane ping spikes when opening gui?

Asked by
3F1VE 257 Moderation Voter
3 years ago

So when I open a gui (specifically a ScreenGui) it causes insane ping spikes (even in game) Heres the code for it.

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)

Answer this question