Why does a simple tween lag so much?

and just to clarify im not like cloning parts and tweening them at the same time. i have a wait in-between each critical “power consuming” code block

I meant change the values in the first value of TweenInfo.new()
not the wait()

yeah yeah thats what i meant mb

Maybe instead of a tween use CFrame:Lerp()
edit: Nvm sorry this is size I forgot

i mean i did try that but its not smooth if you know what i mean. but then again i would rather have choppy than laggy

it would just be a for loop for lerp right

Then you could alter the values to make it smooth. CFrame lerp can be very smooth

for i=0, 1, .01 do
  something.CFrame=something.CFrame:Lerp(goal, i)
  wait(0.01)
end

You could make these values smaller to make it smoother

alright, ty. I’ll test that again to try to get the best performance

1 Like

also for lerping i saw something about an alpha? do i need to set a number for that

That is what i is for. Its the percent of how far to the target you are.
So if you want to be exactly half of a distance to something you would change the 2nd value of CFrame:Lerp() to .5

ex: CFrame:Lerp(goal, 0.5)

1 Like

so does lerping work with transparency because im getting an error, “attempt to index number with lerp”

No only cframe values work with lerp
reccomend just using a for loop to change transparency

oh dang. then i think tweening is my only solution since im changing multiple properties such as position and orientation

Position and orientation is cframe
CFrame captures both the orientation and the position so lerping will work for you

1 Like

There is absolutely no way that the action of tweening a single block would cause so much of a performance issue. Something else is going on behind the scenes that we aren’t realizing. If you go into an empty baseplate, and tween a single block’s size, transparency, position, all at once, it won’t cause any of the problems you have here. I recommend you to try it and make sure actually. And if it does cause problems, then you’re having some kind of bug that should be looked into further.

Exactly, thats what im saying but I have absolutely no ideal what else could be causing it. I optimized my scripts, added debounces, and theres no difference.

1 Like

I would be glad to look into this further if you could share a place or model file of what you’re making. It’s most likely what @tarneks was saying, and that you’re doing this in a loop.

1 Like

I totally agree with @SanctuaryIX
I created a new baseplate, used your code and works with no lag at all, works perfect. There’s something wrong with the other systems in your place

1 Like

okay i tweened a part in a fresh script with no loops or anything and it lags as much. i will send a clip as soon as possible to confirm

1 Like