Server and everything else feels laggy and slow

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.

I see what you mean, but I’ve never understood how you can get things like visuals on the client side, because no one else can see it but you.

1 Like

You can use Remote:FireAllClients() from the server to do this.

I have seen that used before. But I haven’t understood how that is more efficient because it’s doing the same thing as fire server, right?

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.

1 Like

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 …

1 Like

Is that a problem if it’s done in a client script?

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.

1 Like

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:

1 Like

I would never use an open wait on anything. task.wait(0.33) is my limit.
You can always do …

local rs = game:GetService("RunService")
rs.Stepped:Wait() 

I’ll definitely check that, even though I haven’t used any large tables of any sort.

A lot of these tips have been massively helpful to me so far since I’ve never really tried optimising my code.

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.

1 Like

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.

I do that a lot too so it’s not really a problem for me thankfully.

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:

What’s the part count on this?

image
Texture count: 13,674
Decal count: 278