Replicating constant tweens from the server to clients/players joining the game after fired remote event

It’s generally known that you should tween stuff on the client; not the server (simply because visual effects like these should be handled by the client and will look smoother)

I have a problem where I cannot work out what to do if I have an object that should constantly be tweening, how would I tell clients who join the game to tween this object in an organised way?

For example, imagine I’m making an obby. Theres a part that I want to act as a moving platform, constantly tweening it’s position from one area to another. If I was making this platform during the server running with players inside, I can just use a remote event to tell the players in the game that I want this part to be tweened constantly. But how do I make it so clients who join after this remote event is fired also have this part tweened? They would not get the request to have this part tweened, and it would remain still.

Furthermore, if I had a bunch of parts that I wanted to be tweened constantly in different ways on the server before any players have joined yet (when the server starts up), how do I easily tell all the clients to tween these objects when they join?

I know that I would be able to just list every part inside a table or something, but it seems like it would be a nightmare to have many objects to be tweened and having to remember to update a table that I send to players. I kind of have this same problem when wanting to create and render particles on the client but not knowing how to do so if the player is joining after the particles are made.

One idea I had is to make a module store a table of all objects being tweened, and then sending this table to every player joining to tween all the objects at once, though I don’t know if this is the best method.

I hope I’ve explained this well enough!

(Also a side question about replicating tweens from the server to the client: If I wanted to tween a part and I used a remote event to tween this part on the client AND I tweened the part on the server (so they are in sync) will the client see the choppy server tween or the smooth tween on their own client?)

Thank you!

1 Like

Maybe have a default position for all the parts that move. And when the client joins the game, wait until the other clients have their parts in the default position, then start tweening.

Alternatively, you can have remotes fired every so often. For example, if you have a default position, you fire a remote with the position and the part. The client receives the info, then they teleport that part to that default position, then they start tweening one cycle(a cycle is basically one tween before it repeats). Then, it will wait for the server to send another remote for that part then tween again. This method only requires one remote, but can have some cons because you are basically spamming the remote 10 times per second(maybe less, maybe more) for a 100 stage obby with tweening parts.

Depends, the less latency the better(less choppy) it is.

2 Likes

The remote firing every so often idea could work, but I’m looking for something a bit more instant (not waiting for a loop) and efficient. I’m not really worried about each client having the exact same position/tween, just for a way to efficiently communicate to joining players about currently tweening instances.

1 Like