Does anyone know if TweenService has Replication optimisations? i.e. does it update less frequently or not at all the further a player is from the object? Am I better off doing all the Tweening clientside or will it work just as well if I do it from the server?
I’ve always lived by the standard of “never tween on the server”. I always remote to clients for any tweening.
I think the replication side of things would be fine, rather the issue would lie in the amount of resources consumed on the server to perform the tween itself.
You could tell the clients to tween it and then wait for the amount of time to pass on the server, then set it in place on the server so that you’re sure every client has the correct ending properties.
I could, but I think the likeliness is that TweenService already does something similar; i.e. sends the client the start and end point and tells it to tween between them, possibly not sending it at all if the object is outside the client’s vision.
If TweenService was sending CFrame positions for every iteration that would be insanity, I really hope it’s not. It’s just a lot easier to manage it all on the server, and I need to be sure before I script my game.
In our game jam game Split! we had this moving platform and I had the same train as thought as you, but it turns out that’s not actually what is done. The platform just replicated its position at 20-30Hz and appeared stuttery. Best to just write a quick module that replicates the tween itself to clients and does it there.
Wow, that’s insane!? If TweenService is replicating positions every 30th of a second that’s practically the most inefficient way of doing it. I’ll definitely make my own module, might post it here too.
This is not something TweenService does. TweenService just tweens the property, it does no replication. The engine just replicates the property to clients because it has been changed (it doesn’t know that it was tweened).
Oh right of course, what I meant was if it’s causing positions to be replicated every 30th of a second by changing it on the server, as oppose to just telling the clients to tween it themselves that’s really inefficient. There could at least be a parameter or something to make the tween be calculated client side.
I made a module for this: