Hi. So I was attempting to script a projectile that targets a player, actively adjusting its route as the player moves position(A homing missle for short). I was originally going to use while wait() do to update the missles target location, but I thought about how that sometimes leads to jittering and stutter in some use cases(An example would be updating the player’s camera position). So I looked into RunService to elimate any possible stutter. I saw some people using RunService on the server. Previous to seeing this, I always thought RunService only worked on the client, which is a reasonable assumption given that RunService works with frames/framerate, a factor determined by the client’s hardware. But apprently, RunService CAN be used on the server as well.
Can somebody give some insight into how RunService works from the server if, as I mentioned before, it uses the FPS of the client?
RunService (on the server) only works on events that fire after the physics simulation has completed, so that it doesn’t need to rely on the client. An example of an event like this is .Heartbeat. .Heartbeat is fired every frame after the physics simulation has completed, so it can be purely server sided.
If you try to use any other events that depend on the client on the server, you’ll get an error like this: RenderStepped event can only be used from local scripts
Hi! Thanks for the swift reply. You defintely helped me understand a bit more of how RunService works, but Im still a tad confused. You said that Heartbeat would work on the server, because its after the physics simulation, but even so it still runs on the “frames after the physics simulation”, which brings me back to the root of my question: How exactly does that work if frame rate is something determined by the client?
The server is still a “computer” if you want to call it that, so it still has to perform calculations for physics and other things along those lines. I believe Roblox most likely just misphrased it though, because it technically isn’t a frame since the server doesn’t have to render anything graphically, but they most likely just called it a frame (every tick the server runs at) to simplify it.
Some of this is speculation though, so keep that in mind.
Thank you very much! You see, I know servers are just glorifed computers themselves(I own a couple servers that I built myself for game hosting). But i was unsure if by “frame” it meant server tick.I wanted to make sure I didnt have any missconception. Thanks for taking time out of yoir day to clarify a bit for me. Have a wonderful day.