I’m still trying to understand projectiles and everything. So apparently the way to work player projectiles fired from a gun is to create it on their client, send an event to the server, and the server fires an event to the other clients to create the projectile. The server handles damage and raycasts their own nonexistent bullet to see if it hits.
Firstly, if the server ray casts a slow moving projectile, won’t it be desynced with the client and that the client sees their bullet hit a target and no damage? This then comes with the question of if it won’t even hit a target since the server sees everything a second later than the client does after it fires the event.
Secondly, would raycasts still be efficient for a larger projectile like a rocket from an rpg? They obviously are larger than bullets so I was thinking the problem comes with the rocket hitting something on it’s side but the ray doesn’t catch it?
Thirdly, what’s the best practice for moving large objects that do damage? (For example, a small tidal wave). I was thinking tweenservice to change the position, but I keep reading that tweening should be done on the client, but this again comes with the question of how to deal damage then if everyone sees the tween differently?
When you say “the server fires an event to the other clients to create the projectile”, do you mean that you are doing this manually with remote events, or are you saying that the server creates an object and naturally replicates it to the clients? Either way, I assume just creating the physical projectile on the server should be fine, or maybe not, I haven’t done any resource intense server-client stuff.
When you do a raycast, it is done instantly. You will need to add in your own delay and make it work with any visual effects. Remember, a raycast is separate from any visual effects you may have.
If you have something slow like a rocket, it may be better to not use raycasting and let the physical rocket do damage, as the raycast is instant. I haven’t made a rocket before.
There are different ways of moving objects (which may be better or worse than others), such as the tween service (I haven’t used it), setting position/CFrame manually, lerp/slerp or whatever it’s called (with CFrame), and constraints/forces, and maybe more. Maybe using a constraint or force and setting the wave to only collide with certain things would be good. I haven’t used tweening for objects, so I’m not sure about the server client thing. I would assume it can be done on the server (except for GUIs of course).
For number 1, I meant that there is no bullet for the server, the server is just casting rays. The clients have their own local version of the same bullet