Lag Optimization Tips Needed!

Hmm, CFrame causes LOTS of lag

A way to you to do that is using tween service or animation

Well then. What do I do??? I used to use math.rad with CFrame.

Okay. Forget my last message ;-;

Yea yea, Hav you ever messed up with animations or tween services?

Well… see… I’m not exactly familiar with TweenService.

Can you send the entire script if it doesn’t bother you? May I can help ya.

1 Like

Okay sure. No problem. I will send it.

local Speed = script.Speed

for i = 1, 250 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, Speed.Value)
wait(0.025)
end

game.Debris:AddItem(script.Parent, 0)

TweenService is a method to mess with a part, creating animations.

TweenService | Roblox Creator Documentation It can help you

Ok that makes sense, that script causes A LOT of lag because of the Wait used 250 times and the CFrame.

That can be changed easily to tween service.

Wow. It’s sad that on Game Design Support, someone actually knows what to do. But in Scripting Support, I couldn’t even get good advice :face_with_raised_eyebrow:

1 Like

I will make an alternate script for ya.

I have a post already there… I just need to find the name of it.

1 Like

It’s called “Help with part lag needed”. I just found it, listed under scripting support. Tags = Lag
I think…

1 Like

A better idea would be to use heart beat from the service RunService. It runs every frame and gives you the exact time since last frame(known as deltaTime or dt)

CFrames don’t cause lag any more than anything else. Wait is also deprecated.

CFrame also causes lag a lot some times

Sorry, I’m gonna try it out rq.

1 Like

You can try to use body velocity too. I have a train game which uses body velocity to move the trains and I have multiple trains moving and it dosent cause lag

1 Like