Game extreme lag

My game has extreme lag and is unplayable, I do not know why. I have looked through the scripts and nothing seems like it would cause this. Note: the game was made over a year ago, maybe some changes have been made to roblox?

link: Work at a Hotel! | CE Resorts - Roblox

after disabling all scripts, it is 100% related to rendering

SOLUTION: one of my devs who got fired added a script that did this. it has now been resolved.

make a setting where the parts have no color, tho its crap optimization its better than nothing

1 Like

It could be that your scripts in the game are running too many processes at once. I doubt it has to do with the parts in your game as (at least surface level) everything looks pretty simple and easy for the Roblox Engine to render. I’d suggest opening the Script Performance tab in Roblox Studio, then playtesting to see if any scripts have a large Activity percentage.

1 Like
  1. Check scripts there might be plenty of them that are useless and do alot of useless functions

  2. Check if your map contains free models that have alot of parts in them

  3. Check models inside workspace and see if they have alot of parts in them

  4. Check every script and make sure there isn’t any unnecessary loop inside them that make it for example spawn parts/print stuff

They all have 0%

1 Like

image
28k parts isnt that many- but for a map like yours it kinda is
where are all of these extra parts?

and did you make your trees/plants/rock meshes or did you get them from the toolbox?

i made the meshes and there are so many parts bc the map is actually kinda big if you go to the back area

while true do
script.Parent.Velocity = script.Parent.CFrame.lookVector *script.Parent.Speed.Value
wait(0.1)
end

could this script on the slide be the problem

This is a bit hard to figure out, but going off the microprofiler, the issue is definitely related to rendering:
image
rendering alone takes 14ms, while at 60 fps each frame is 16ms - meaning 14ms alone is spent on rendering here. To make sure this is 100% not a script, you should try copying just the map onto a separate test place, and run this code in the command bar:

game:GetService("ChangeHistoryService"):SetWaypoint("Remove scripts from workspace")

for _, Script in next, workspace:GetDescendants() do
    if Script:IsA("LuaSourceContainer") then
        Script.Parent = nil
    end
end
1 Like

It is 100% rendering, I ran the script

around how many tris per mesh?

Do you use any meshes in the game? Even if the part count is fine, some meshes could have extremely high tri-count. Roblox limits at ~20k tris per mesh, but if you have a lot of those meshes, it could become an issue.

i honestly dont know how to check that

Try running this in the test place:

game:GetService("ChangeHistoryService"):SetWaypoint("Remove meshes")

for _, Object in next, workspace:GetDescendants() do
    if Object:IsA("MeshPart") then
        Object.Parent = nil
    end
end

Additionally, do you lag in studio when viewing the map?

i use a lot of meshes, how do i check the tris per mesh

You sadly cant, Roblox doesn’t expose any API for that :confused:
Closest you can get is by enabling wireframe rendering and looking at each mesh separately:


this is our map wireframe rendered, is this a lot of triangles?

yes, actuaklly it is a decent bit of lag in studio. will test

I ran the script and I still see meshes and lag still remains