I have noticed that client sided tweens are less choppy especially over slow connections.
However if I just replace ever server sided tween with SomeTweenEvent:FireAllClients() then any would be tweens would be missing if a client joins while they would be in progress. Also if there is a persistent object whose lifetime is longer than the tween duration, if they join, the object will exist but will not be as though any tween has played. For example if I am tweening a transparent object to be visible, if a player joins afterwards there would be a permanently invisible object. What is the best approach to solve the pitfalls for client sided tweening?
Can you elaborate more the topic and make us understand what are you trying to achieve precisely?
I know there is something called :SetNetworkOwner() if you need to move a part that the client own (like a car)
I’m thinking of this solution as I’m writing this out, and I’m not at my computer either.
Maybe you could set up a boolean value in your script for your tween, and then whenever you play that tween and send it to the clients, set that value to true, then false when the tween is stopped.
Then, maybe you could try listening for the playerAdded event and then check if that Boolean is true to fire the event to that specific client that just joined. Unfortunately, the tween for them will be later than everyone in the server already, but at least it’ll play.
Like I said, I’m not on my computer at the moment so I have no way of testing this.
What if a part can be arbitrarily created, and will last a while, but it starts out with 100 percent transparency and tweens to be opaque so it looks smoother than just suddenly appearing. If a player joins after the part should have been tweened but before the parts lifetime ends, it will be transparent to them.
You could add a “TweenTransparent” tag to the object and set an “EndTime” attribute with a time stamp of when the tween should be completed.
On the client, when the player joins, for all instances in CollectionService:GetTagged(“TweenTransparent”), run the tween with a length of instance:GetAttribute(“EndTime”) - workspace:GetServerTimeNow(). Then connect the same function to CollectionService:GetInstanceAddedSignal(“TweenTransparent”).
On the server, when you want an object to disappear in tweenTime seconds, first call instance:SetAttribute(“EndTime”, workspace:GetServerTimeNow() + tweenTime), then call CollectionService:AddTag(instance, “TweenTransparent”).