So, I was doing some dashes and gun system on different games and I also coded them over 1 day. Then I play them on roblox. The first thing is. Everything is look completely fine, but after that. My ping starts to increase continuously without any decreasement.
Here’s the ping after around 1-2 minutes
Here’s the ping after around 10-15 minutes
Anyone could fix this or have the same problem like me?
This looks like a memory leak. You can use game:GetService("Debris"):AddItem(instance, seconds) right after creating the instance to make sure it gets cleaned up eventually even if something else in your script breaks.
The real fix for this would be to fix whatever in your script is causing the instances to not be destroyed (you probably are just forgetting to destroy something). For a gun system, I would also recommend using a raycast-based system instead of parts with physics.
Also, make sure there’s some kind of check to make sure the bullets don’t just fly forever. (Using Debris will cover that)
I was thinking of using raycast. But I already made a flying bullet just in a distance from character to bullet. And I used debris too. Maybe it’s because the script runs too fast on bullet part.
Ping also happens to my another game with dash system too, but not for other people.