I’ve been trying to make a projectile that stops moving when it touches a wall but the projectile stops way before it hits the wall on the client.
(here’s how it looks on the server and on the client)
send a start time to the client using shared workspace time. this time is shared perfectly. then on the client reconcile the start position based on the amount of time that has passed, from the time the client received it. this could be 0.2 seconds for example then we spawn the part 0.2 seconds further on the client
*this requires some more advanced logic.
how would I be able to do that if I only use server scripts for the projectile ? Would I also have to start using local scripts ?
what id do is create a clone of the projectile on the client. then i gave the same velocity to the clone and stop make its position the position it should be at based on when the projectile was created on the server and the time you received the remote on the client.
( sorry I’ve never done this before I’m kinda new to scripting )
I’m kinda confused about when to create a clone of the projectile and also, wont the client see 2 projectiles now ? And hwo can I calculate the delay between the server and the client ?
well then this approach is a little too advanced. but i fear the only way to achieve the perfection you are trying to get. the client would see 2. but you can set the transparency of the server projectile to 1 making it invisible. and for the difference between the server and the client you can use workspace:GetServerTimeNow(). this returns the time of the server. both server and client will have synced server times. so on the server you get the start time using workspace:GetServerTimeNow() and on the client you use it when it receives the remote to create a projectile so then you also call workspace:GetServerTimeNow() on the client then you can check the difference between the time that the server created it and the client received the remote. this way you can check how much time has passed that you missed because of a delay between the server and client. then you could create the part at a further start position that you calculate based on its velocity and how much time has passed.