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

why does a tween lag so much?

Asked by 4 years ago
Edited 4 years ago

simple tweening on one block(not a mesh) spikes my ping to around 600 only when shrinking. It's a tiny bit tough expanding it, but it's totally not right for it to be lagging that much for one brick. My code:

    local TweenService = game:GetService("TweenService")
    local TI = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
    local T2 = TweenInfo.new(.2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
    local properties = {
        Size = Vector3.new(4,5,0.05) -- expanding
    }

    local properties2 = {
        Size = Vector3.new(.1,.1,.1) -- shrinking
    }

    local Tween = TweenService:Create(i,TI,properties)
    Tween:Play()

    wait(2)
    local Tween2 = TweenService:Create(i,T2,properties2)
    Tween2:Play()

Before, my shrinking properties' value was set to (0,0,0) and i had thought that was what was making it laggy asf because in my mind, it was trying to round it to the nearest value of 0, which would be like 0.1111111e or something like that, and that would make sense, but after setting it to (.1,.1,.1), i found out that wasnt what was making it lag, so at this point im a bit confused. I even made a debounce to make sure it wasn't tweening it 1000 times at the same time but no luck. I also make my tweens faster to make the lag go away faster but it's still there. Update 1.7.21: I am still confused about this. I even replicated the tween to each client through a remote event, and it still lags as much.

Answer this question