I’ve been working on a game with a couple of friends recently, and around 3 - 4 days ago the game has been lagging EXTREMELY bad, and I can’t even replicate it.
Firstly I noticed it was happening when I hit something with my stand, like this:
As you can see, my frames drastically decrease whenever hitting the dummy, though don’t decrease when hitting the air.
I dumbed the issue down to this part of my code:
Commenting out the damage.Parent part or anything else fixes the lag completely.
(Yes, literally instancing in a part then parenting it to the workspace is lagging the game)
So, I just removed that part of my code and moved on- yet a couple hours later I saw ANOTHER issue with it, this time with my teleport code:
This also seems to produce frame drops, though I am not sure why.
Now, I’d be fine with this and just draw it out to being an issue with my code, if it weren’t for the fact that this was all working a week ago, and no changes to the effects have been made recently.
As you can see in this gif, there is no framedrops at all:
This was taken roughly a month ago.
Some extra information:
This is a Team Create place
We use streaming enabled
I cannot reproduce this in anyway, it seems to just be localized to this
Disabling streaming enabled or testing in a live server does nothing to fix this
Other things that are rendered on the client (Like damage counters), do not cause any framedrops whatsoever.
Other people (my coworkers and playtesters) are also experiencing this, its not just me.
If you need any extra information or you think you have a workaround for me to try please reply to this post.
Makes sense, though this is occurring as soon as the server starts, so its not due to any part buildup, so it probably isn’t because I didn’t destroy them. I’m also pretty sure debrisservice internally destroys them.
Nothing that would cause lag- all I do is connect things to .PlayerAdded and .CharacterAdded for rigbuilding and such, no instancing parts or anything is done.
@wish_z @ValuedSins
Let me repeat that this is only occurring when I instance a part and parent it to the workspace.effects for making an effect like a teleport. There are no connections to workspace.effects.ChildAdded or workspace.DescendantAdded.
There is no lag randomly happening at all during gameplay with the rendering code in the OP removed, so its all dependent on that.
I would say that this is an engine bug, if I was able to repro it in a separate placefile or separate script, but it seems to only happen in this specific occasion.
Well you’re not instancing 1 part, you’re creating multiple and parenting them. Do you ever destroy these parts? and how long till they’re destroyed if so?
If your talking about Move.DamageParticleAmount in the for loop, this generally only runs once and doesn’t run multiple times. If it does its at small amounts like 3 or 5, sometimes bigger depending on the move.
By looking at the explorer with this code enabled, only one part gets added and gets removed after 3 seconds (I commented out that part of the code because it didn’t hold any relevancy to the lag, but it is not commented out in the actual game)
Hello, I assume your lag is based on excessive tweening on server-side.
Or, it might be because of physics rendering calculation.
Is the script serverscript? If it is, it’s an extremely bad practice to put tweening inside for _ do loop since server memory will be used excessively and cause performance issues such as FPS dropping.
Instead, use RemoteEvent for your case. You can fire RemoteEvent to the server when player is punching, and the server fires RemoveEvent to all-clients; which is not involving the server to do any heavy calculation.
Please give me a little feedback about this after changing your tweening with this method.
Sadly, I wish that was the case.
I actually AM doing rendering on the client, that is actually a snapshot of my main Client script, with the second one being a screenshot of my other script that receives the remote event and does the effect.
Main reason why its so confusing to me, as I’m not doing anything relatively intensive, and it was smooth a week ago.
To the first one, a decay parameter was added, though after removing it nothing changes.
The second one has always worked fine until now and hasn’t been changed whatsoever.
The game has a few testers, so we have been testing with multiple people since the start.
So, the game ran smoothly a week ago, now it does this.
I’m 99% sure this is a Roblox bug, but I can’t reproduce it anywhere else but in this exact occurrence, so it wouldn’t be easy to add a repro so anyone could figure out what was causing it.
Sry for the complete necropost but did u ever find out what caused it? im having the same problem, no childadded/removed connections or anything but when anything gets parented/removed to the workspace, theres a fps spike. ive been digging and cant find any solutions. if u have any idea pls reply thank u