Tweening important objects server and local side

Hello lads.

I’m currently remaking my very first published game and in the process got stumped on a not so important but would be nice to have feature that I’d like to talk about.

In the game this wall moves back and forth, using tweens:

GIF

ezgif.com-video-to-gif(1)

However, it’s not too difficult to notice its jitter when done server side (due to limitations set by Roblox) and when the tween is fast (which is preferable). Tweening the wall locally is no issue, and I’d love to keep it that way - however then I have to trust the client to properly report on colliding with it in order to inflict player damage (no bueno).

My first idea was to clone the wall, move one server side and just set its transparency to 0, the other client side… issue with that - sync. Out of sync and I’d have to make things more complicated for myself in order to sync everyone to the same wall.

Have you guys every encountered something like this and how did you work around it? Again, it’s nothing crucial, so I don’t mind keeping the jittery server side tween, but I’d love to know if theres a proper way around this.

2 Likes

You can have a purely cosmetic client side tween while an invisible barrier moves at the same pace (that way, there is still a smooth movement but it is hard to exploit.)

1 Like

Thats the thing, I tried it already but as I mentioned it is completely out of sync as local code runs at a different time than server sided. Then I have to think of ways to sync every each player both already in game, and joining, to that invisible wall…

1 Like

If you tween both at the same time, besides for latency, they will arrive at the same time in the game world. You can then update the position for new players to display the cosmetic barrier at the location of the server-side barrier.

2 Likes

you can make a few tricks to make desync minimal, don’t detect collisions on client, if it’s singleplayer game, maybe it’s safer, but if multi, it will break entire game. You should make that firstly wall is moved on server, then replicated to client, not client to server!

@FactorOfTheThird if this problem has been solved for you, make sure to mark a solution. I can provide more help if you’d like.