Hi, I have a problem. I’m making a system that executes effects through remote events and tweening on the client. When an effect is needed, I use a certain event and pass the tween data through it, the client(s) pick it up and execute the tween. For example, I move part from 0,0,0 to 10,10,10 through a tween.
Here’s the catch, I’ll also need to change the data on the server, but I won’t use a tween, because it’s being done on the client already. The problem is that the server overrides the client tween due to replication, which means the tween looks like it’s being finished instantly when in reality it’s just being manually set to the finished position from the server.
The reason why I can’t just tween on the server and call it a day, is that I’m going to need sooner or later a system on the client that remove effects (for performance). So how would I write my system so that I can incorporate this, run effects on the client, and also update the position on the server?
You could use a client sided tween.ended event to fire a remote to server to update the part position. Although you would also need to account for every client running the tween before updating the server position, and include a timeout to cope with lag or a player disconnecting.
Or
You could set the network Ownership to the client run tween then set it back again to server. Depends on how many players this would be viewed by simultaneously.
A: for if what you want to do is hide the object from the client, you could probably just parent it to a folder in replicated storage from the client and handle everything else on the server like usual
A 1.5: adding to what I previously said, you could also clone the object, put the server handled version of the object elsewhere (like a folder in replicated storage) and handle the clone on the client, and then delete the clone and restore the server handled version whenever necessary
B: handle the server stuff first, then send data (like start and end position of a tween, other properties, etc.) through a remote event to handle from the client after the server has done it’s work
I haven’t tested either of these but I believe one of them could probably work for what you need
Your B Part, that’s exactly what I’m doing, but in fact when I do that the server for some reason overrides it and sets it up to the end position anyways.