#Why does it lag like that?

1 messages · Page 1 of 1 (latest)

jolly abyss
#

crying it is truly an "Eye-popping moment".
But seriously why does it lag(this has happened to me before too)?

local function DestructEye()
    local HolderPos = Holder.Position
    Holder:Destroy()
    
    local NParticles = math.random(5,13)
    
    local ParticleInfo = TweenInfo.new(0.5)
    local ParticleInfo2 = TweenInfo.new(1)
    
    for i=1,NParticles,1 do
        local Particle = Instance.new("Frame",CogParent)
        Particle.BackgroundColor3 = Color3.fromRGB(255,255,255)
        Particle.Parent = CogParent
        
        local PartS = math.random(100,400)*0.001
        Particle.Size = UDim2.new(PartS,0,PartS,0)
        
        local Corner = Instance.new("UICorner",Particle)
        Corner.CornerRadius = UDim.new(1,0)
        
        local RandomDirectionX = math.random(100,300) * 0.01
        local RandomX = math.random(1,2)
        
        if RandomX == 2 then
            RandomDirectionX = RandomDirectionX * (-1)
        end
        
        local RandomDirectionY = math.random(100,500) * 0.01
        
        local GoTo1 = UDim2.new(RandomDirectionX*0.5,0,RandomDirectionY*(-0.05),0)
        
        local ParticleTween = TS:Create(Particle,ParticleInfo,{Position = GoTo1})
        ParticleTween:Play()
        game.Debris:AddItem(ParticleTween,0.5)
        
        local function WaitALittle2()
            ParticleTween.Completed:Wait()
            local GoTo2 = UDim2.new(RandomDirectionX,0,RandomDirectionY,0)
            
            local ParticleTween2 = TS:Create(Particle,ParticleInfo2,{Position = GoTo2,Size = UDim2.new(0,0,0,0)})
            ParticleTween2:Play()
            game.Debris:AddItem(ParticleTween2,1)
            game.Debris:AddItem(Particle,1)
            
        end
        
        coroutine.wrap(WaitALittle2)()
    end
end
austere fog
jolly abyss
jolly abyss
#

Do you know how to fix it?

austere fog
#

have u tested it with other ppl too

#

what if its js you

jolly abyss
#

Uhn

#

Thanks

dense sundial
#

game.Debris:AddItem(ParticleTween,0.5)???

jolly abyss
#

Dont you delete tweens?

dense sundial
#

yea?

jolly abyss
#

Or am I supposed to not delete them?

dense sundial
#

just use stop?

jolly abyss
#

But they will still be there no?

dense sundial
#

no?

#

tweens arent objects

#

and plus why are u adding debries on a ui?

jolly abyss
dense sundial
#

no>

jolly abyss
jolly abyss
dense sundial
#

dude

#

tweens aernt objects

jolly abyss
#

They get deleted, is that what causes lag?

dense sundial
#

just do tween:Stop

dense sundial
#

the debries

jolly abyss
jolly abyss
dense sundial
#

because tweens arent objects

dense sundial
#

no!

jolly abyss
#

Then how do I delete eye particles?

dense sundial
#

stop

#

:stop

#

or destroy.

jolly abyss
#

I stop the tween but the frame that is tweening still exists

jolly abyss