So I’ve noticed that my game has been running fine in studio, but differently in Roblox. In Roblox, the game feels slightly slower at the start (mainly the server script like combat was slow). Then gradually it was getting slower and slower and my ping was going really high (up to 375 ms).
While I was in that server, I was with another person testing it out who had a very low ping unlike mine, so I’m assuming it might be a time zone or region issue. However, the game began to act like it was getting laggier and slower with increasing ping for what reason I don’t know.
The combat system is pretty normal as it’s basic and fires remote event each time used with performing the damage, vfx and knockbacks on the server script (not sure if scripting like that is good enough in roblox these days).
I’m considering that it’s due to some time zone difference or my scripting which makes the servers lag. I would really appreciate it if anyone could come up with a way to fix this sort of lag.
The reason this happens is because you aren’t connecting to a Roblox server during studio play sessions.
If you feel that your combat system is too delayed/laggy, you might be relying on the server to handle too many things too fast. Try relieving stress off the server and handling smaller, less important tasks and visuals on the client side.
Keep in mind, stuff like this will always somewhat depend on the player’s ping. It is a multiplayer action game. However, players shouldn’t be averaging the ping you mentioned.
There is a big difference in those uses of RemoteEvents.
Using Remote:FireServer() from the client sends information to the server.
Using Remote:FireClient(plr) from the server sends information to the given client.
Using Remote:FireAllClients() from the server sends information to all clients.
I would HIGHLY recommend running visuals and effects on the client. Having too many things happening too fast on the server can definitely slow the server down, sometimes to the point where it crashes.
Roblox even implements ways for developers to relieve the server from physics simulation using BasePart:SetNetworkOwner(). In fact, this is how character movement and replication are handled as well.
Ah I got it, so basically e.g - visuals being made on each client would be less stressful and much more faster than all of it happening at once on the server…? I think I understood it pretty well if my logic here is correct based on what you explained?
People don’t seem to understand the wait thing too well. Keep seeing wait() or wait(0.02), this is way to fast in a loop and leads to lagging out … possibly even locking up. Not sure if that is your issue here as I see no code.
Also if you’re using sever side code or remotes to sever scripts. If the server is lagging, say maintenance of some type. From time to time your games will lag. Just come back a bit later and don’t feel like this is permanent. Just how it is …
Yes, you are correct. This is especially true if you are creating objects, tweening/animating and adding effects onto them. There’s no reason for that to be server-sided if the server isn’t going to be referencing them.
Using task.wait() in loops on the client shouldn’t be stressful as long as it isn’t being done an unnecessary number of times. And even then, you would need to literally be abusing the client for that to affect them.
This could be a sign of a memory leak. You could have forgotten to disconnect a few connections here and there or to set all references to a large table or Instance to nil. If you believe this is the case (you should probably check anyways), here’s a few resources you can refer to:
I’m talking about the general use of task.wait regardless of the parameter. Using it on the client for a loop is definitely not the reason he’s encountering massive ping issues.
There is also a lot of things you can do to lighten the load for the program with objs.
CastShadow, CanCollide, CanQuery, CanTouch, Locked, Anchored, Massless …
For example: If I have a part that is never going to move or be using a script, I’ll set that as …
Locked, Anchored and Massless, (CanQuery, CanTouch false). Now the program don’t have to figure mass or any of that for that part. If I can get away with no shadow I’ll do that also. 100s of parts set like that will update way faster than not.
For me, it’s the opposite. Lag in ROBLOX Studio, but perfectly-acceptable performance in ROBLOX. I just have a feeling that ROBLOX Studio feels less graphically-capable than the ROBLOX client.
Here’s video footage of ROBLOX Studio (failing to) run on my 4060 TI: