!HELP! on fixing LAG

Hello fellow devs,
I have a HUGE problem in my game (partnering with @ObbyCraftsman), everything is working fine, but for low end devices the game is LAGGY!
If you have a low end device you can try it out right here:

The game has 500 average players on non-weekend days and gets up to 1k players on weekends. We get a miserable dislike rate because of the lag so it needs to be fixed ASAP. Out Game is “huge”, uses a ton of scripts and I do not know where to start.
What we have already done:

  • reduced the datastore amount from 10 to only 3 datastore (one global and 2 sorted datastores)
  • prevented most “while task.wait(0)” loops which can cause lag
  • yields and checked for viruses

You can clearly see, also on a high end device, that rendering stages far away is already a problem for the loading screen and even me, on an iMac from 2017, opening workspace causes “lag”?


You can see how huge the game is (idk if it helps, ive put most of workspace parts in this folder)

It would be a HUGE help if anybody could help us as soon as possible, would also reward you if you want!
Sincerely,
Mystery and Jake

3 Likes

I believe I could help. You can message me via the forums and we can go from there

2 Likes

maybe you could try to use content streaming

if there are obstacles that have their movement physics-based, you could also try anchoring them until the player gets nearby if they are cloned to each player’s client

1 Like

I think I have heard of that, maybe used it some time ago, but maybe I have used it wrong, everything errored when I tested (like the objects in workspace have been removed and local scripts in start ui are giving nil errors)

1 Like

if you want i could try to provide a link to the page on the creator hub

it would require some of the levels maybe to be grouped to models to have better control over what gets streamed in or out though

1 Like

this would be awesome. So it works that it filters out everything you tell it to filter out (except maybe whitelisted parts like checkpoints, etc.)?

1 Like

you can set models to have a specific behavior when they attempt to be streamed out,but im not really experienced in using this feature, so its best to experiment with it first before implementing it into your real game

1 Like

Just how many Parts are we talking here in the entire place? I see what looks like a lot of items in your ‘bushes’ folder. That might be a problem with rendering.

Do you have lots of Constraints in your place (Hinges, Prismatic, etc)? Lots of physics constrants need to be calculated so that might be an issue.

When i print every descendant of the workspace its like 51k instances

Yea, to hold on spinners, falling platforms, welded parts (halos). But it might not all be the HUGE workspace, but also the scripts. Maybe something is causing lag, maybe there is like a way to find out which script could possibly cause lag?

All I can say is to see what is using the most rate(/s) and work from there.

How would I be able to view what script uses rates the most?
I have some scripts which have around 2k lines of code, manymany scripts…

See it from the console when playing.

Edit : If you see a script using a lot of rate then just try to optimize it. Also I’d recommend seting CanTouch to false for most parts where u don’t need CanTouch set to true also try to minime the amount of parts when a player has a lot of ping (if you want / can)

This is an excellent idea! Will do for all the parts where it isnt needed

One other thing I’d recommend is to turn off cast shadow and global shadows if you haven’t yet.

Ive done that for most parts, but it isnt set off in lightning itself

you should try to make a script that anchors some of these parts once they are a certain distance away from the player, because it appears that a lot of these obstacles have physics calculated on the client which probably would put a heavy load on many low-end devices

another small thing you can do is that if there are animated conveyors in your obby, you can try to have an option to turn the animation off




This is what it looks on console

1 Like

One “Script” is having rate of 54.000, idk if that high or not + you where right, the conveyor script has a high rate too

This is the current script for the conveyor:

local addConveyor = function(c)
	if c.Name == "CONVEYOR" then
		c.Parent.Velocity = c.Value*c.Parent.CFrame.lookVector
	end
end

workspace.DescendantAdded:Connect(addConveyor)
for i,v in pairs(workspace:GetDescendants()) do
	addConveyor(v)
end

i didnt add this but this seems SO MUCH OVERCOMPLICATED? especially calling every descendant :skull: