Will a large amount of tweening on the server cause lag?

I’m going to be tweening a large amount of rigs (basically default R6) along a path (Say 50+), on the server. I’m worried about the lag this may cause, as the rigs are all playing animations (like walking) at the same time. As I need to keep track of the rig’s current position, I don’t believe I can just use the clients themselves to run the tweens (For security reasons). Will this cause lag? Are there any better ways of doing this?

I’m already offloading the tweening function for each rig into a singular module script, not sure if that helps in reducing lag.

Tweening should be handled with a localscript, mostly.
Otherwise you’ll notice a few server-skips since the server has other tasks as well.

Tweening itself does not cause lag, it all depends what you’re doing with it, but in theory you should be able to tween a decent amount of parts just fine.

4 Likes

Alright, after testing out the difference between tweening on a localscript and on a server script I can definitely say that the local script tween is far smoother…

So it seems that I should be doing all the tweens on a local script. How intensive are tweens for the client? To tween a rig, I have to tween 7 parts at once per rig. With 50 rigs, that’s 350 tweens moving around at the same time. I have a fairly good pc (ryzen 5 3600, rx 580, 16gb ram) so it’s not like I can test how the tweens would work on a potato device.

Unsure of why you would be tweening rigs in the first place, you should look into Pathfinding and Humanoid:MoveTo, but like Inf said… tweening on the server should be avoided whenever possible due to the performance implications (and more often than not, not all clients are within range to see whatever you are doing)

1 Like

I tried using Humanoid:MoveTo, but it was… inaccurate? The rigs would end up either right next to or around the specific position I wanted them at, which was pretty irritating. The problem is, I need precise positions, and I couldn’t get Humanoid:MoveTo to give me those positions accurately.

MoveTo needs to be used in conjunction with PathfindingService, as you’re generating a list of waypoints for the humanoid to follow, there’s no accuracy issues with the correct implementation.

Tweening is not the way to move humanoids.

Could you give an example of the correct implementation? I’ve tested the code roblox has on its api page Humanoid | Roblox Creator Documentation and it wasn’t accurate.

I linked the wikis documentation for Pathfinding in my initial post, it’s a more complicated topic if you’re not well versed in lua yet.

Also, I don’t have any reference code for how you are moving these rigs so it’s kind of hard to make an example.

Yeah, after posting that I realized that was weird to ask… I’ll take your word that pathfinding with moveTo is accurate and mess around with the two. This is kind of getting off topic… so I guess I’ll just mark an answer. Thanks!