My game runs smoothly until you sit down, it causes a lag spike

I recently redid a bunch of stuff in my game to reduce lag, like getting a simpler rain particle emitter - getting more efficient scripts - and when I play my game now, everything is very smooth and doesn’t lag at all.

However, when I sit down in ANY seat, it will cause an INTENSE lag spike for all players. I tested this with my friend, and when either of us sat down we both experienced lag spikes.

I have no idea what could be causing this, or why in the world it’s so laggy only when you use a seat. Can someone help me out with this?

4 Likes

Have you tried enabling the in-game microprofiler and taking a look at the results (yes, I know the microprofiler is poorly documented, but the results might help find your issue)?

Have you tried enabling the in-game performance stats and seeing whatever spikes when you sit down (ping, GPU, etc.)?

Does you game have any scripts that check if a player is sitting down? Does the seat itself have any scripts or events relying on it?

Is this issue happening in Studio, too? Try testing the game with “Play Solo” in Studio, and see if the bug still persists.

Is the seat anchored? My best guess is that this is a physics issue or a script issue.

1 Like

Does the seat have any scripts?

1 Like

All seats are anchored, and there aren’t any scripts in them.
Here’s what the microprofiler & pref. stats look like, the circled part is when I sit in the seat.

In Game:

In Studio:

In-Game Preformance Stats:

My graphics quality is at max, but it still lags when I sit unless it’s at the last notch and there’s no other players in game.

No, I don’t. They’re anchored too.

Well, that is a very interesting situation. Perhaps there is an backdoor in your game.

I highly doubt that, I did a virus scan in my game fairly recently. I don’t think I’ve added anything to the game that isn’t made by me since then.

Are you the only developer of the game?

No, but none of my developers have added anything new either, only some scripts made by themselves. I keep track of pretty much everything added- I can do backdoor scan right now to be sure though.

I didn’t find anything. Could it be the amount of seats? There aren’t a ton though-

How many parts are the seats made of?

It’s just 1 seat part, they aren’t grouped.

Ensure you really don’t have a backdoor. Roblox seems to have more malicious developers making plugins that insert backdoor scripts deep inside your game.

Use the Explorer and search for the word ‘script’ and look in every script you have ingame.

If seats cause significant performance drops, you could create your own implementation of seats.
Seats utilise welds, so, you could send a request to the server and create your own weld between a seat and the player. If you don’t want to implement your own version of seats, I think I might have a vague idea of what may be causing that lag, Network Ownership, according to the Roblox Wiki Network Ownership | Documentation - Roblox Creator Hub, even though you probably aren’t dealing with cars, your models network ownership may be transferred to the player, try manually setting the models network ownership, I doubt it’s the problem but, it’s worth a try.
Edit* If it is network ownership that’s causing the problem, try anchoring the models primary part(if it has one)

1 Like

Use the microprofiler again but when you sit down with it open, press CTRL + P. You can then look at every process that happened in every frame. All you really need to know is long bar = bad. Find out which bars are the long ones and post them here.

Here’s a video that shows use of the microprofiler when paused.

Here’s what I get when I did that, it was a little confusing to look at but I hope this can help -

I remember having that exact problem five months ago. It’s caused by using too many lights.

Builders like to do this thing where they add 20 of the same lights into one part. This is inefficient as hell and you should really just use one light and turn up the brightness. So make sure to look for that.

If you have multiple lights really close together, replace it with one light that has a larger range.

1 Like

I just removed a bunch of lights, it didn’t change very much

Im actually having this exact issue with my game to. Sitting down in a area with a lot of instances makes it lag a lot more. Yet if you move the seat to somewhere else without a lot of instances its lag free.

1 Like

This may sound real odd but try moving the books/bookcases/just everything except for the seat far away. Then try sitting back in the seat, if nothing changes, something is wrong, if it begins to be lag free, it may be due to the concentration of alot of instances/objects near eachother. This may be intensified by the chair due to the fact it creates a weld when you sit though I may be wrong?