Help on how to implement rendering a projectile on client(s)

i’m trying to make a projectile that is rendered on the client(s). i have been told that this is better as it puts less strain on the server and looks more smooth. However, i have absolutely no idea how one would go about writing a script (or local script) that would handle this.

The big questions so far are if I need to write a whole system that can handle any request to achieve this (creating a real invisible projectile, and creating fakes on the clients with the visuals) or if it is possible to write it specifically for that projectile. I also wonder what method I should use, as I am not sure if i should use remote functions, or remote events, or actually creating local scripts and writing in the code from the server.

(I would also like it if someone could explain what is really going on in the process of rendering stuff client-sided, because i have a hard time trying to understand this)

1 Like

Rendering on the client essentially involves the use of remote events to make clients play something rather than the server, and yes it is better to render things on the clients than on the server. For example, on the server before you would create a fake invisible projectile and move it for the hit detection, and you would use remote events for clients to replicate that invisible’s part movement but with the actual projectile. And can u provide more info on the projectiles

What type of projectile effect are you trying to achieve (linear, parabolic, etc.)?

Rendering a projectile on the client, while less laggy, is typically more resource demanding so it might not pay off fully in the long run; you have to make use of several remote events in order to render the projectile on all clients.

In my own personal experience, making a projectile render on the server is a lot easier in terms of coding than scripting a projectile to render on each individual client. If you were to use client-side rendering however, you’ll have to set up some sort of “ProjectileFired” event in order to send the message from the client to the server. From there you can have either a remote event or a remote function to take information from the server to the client using FireAllClients() with the same information passed through originally.

It will end up being a very bulky system due to the fact that you have to pass multiple information from the client to the server and back to the client several times in order to make a functioning projectile. Like I said; it’ll probably be better to just render it on the server as opposed to each individual client.

In terms of why it is better to render things client-side; it comes down to a matter of stress put on the server. More things being rendered server-side will obviously cause more lag, with that being said, depending on the type of the projectile it most likely will cause lag either way. It really comes down to a matter of what you are already putting on the client and the server and which one you think would handle it with the least amount of damage done to the integrity of the game.

1 Like