I am currently working on a power system, I’m using a module script for each unique power that is inherited to a base power (human). I want to make those powers have smooth server(math) and client(visuals and animations) actions, what I mean by this is I would like to minimalize delay between the move’s math and VFX.
I am not sure how to go about playing the VFX that the moves/attacks are going to have. I only want to play the VFX animations on the client, playing it on the server seems too laggy. However, I want to do all the math and raycasting on the server. And realistically, I would like to have the visuals and the math in the same attack method that the power has (probably impossible). But are there any workarounds that could help?
I can have an event connected to each move but that seems way to tedious, so I’m not sure what to do. Any help is appreciated.
If anyone has a tutorial or a reference to a similar topic please send a link because I have not found any information on this.
You could use a RemoteFunction, when the client invokes the server with parameters like mouse position (which has to be on client) and then Raycast and do the math on server, complete sanity checks and return the math values to the client to do the effects, but you will suffer some de-sync probably.
I’m on mobile so I cant write much of the code but this will be your idea.
Thanks, this does answer some questions but also, wouldn’t I have to create a lot of remote functions? My question is this, for example, one of the powers is going to have a transformation move to equip the power. On the server I’m going to add and weld all the necessary models to the character (the server function is going to be called first by a remote event), but I would like to play the transformation animation on the server, which I don’t know how to make the client do only that because every power is going to have unique animations and effects. So should I make 2 module scripts for the same power? One for server and one for client animations and such.
Would I have to make a separate remote event/function for each individual VFX? I would like to have the VFX be part of the powers module script since every single power is going to have unique VFX. Making an individual function for every single move doesn’t seem like a good system but I could be wrong. My problem is how do I make it so that the VFX is part of the module script, yet the module script runs the math on the server and the VFX on the client.