Ping crashing the game

Ok, so I have been making a game for some time now and it was working properly but recently it started having problems with ping. It starts off normally and then the ping drastically goes up until everyone is kicked out because of “internet connection” (in studio it freezes and i have to shut it with task manager). I checked for any backdoors (getfenv, setfenv, loadstrings, require) and the only thing were requires from my scripts. There is no output spam in the log and there is nothing unusual in script activity. What could that be? Heres the game: Voidlands - Roblox (you have to join a game)

You should send a clip or you should send scripts. I highly doubt anybody would even be able to find anything wrong with your game by just playing it (it’s inconvenient to join it)

Tried playing the game regardless and I can see the ping spiking but it only occurred once the rain began. This could be because of incorrectly handled sounds or your rain particles.

I’ve tried the game and my ping went to 1000 then it kept going up until it was at 12k and then i disconnected. It’s most likely not due to any backdoors.

I thught that too but i forced sun and it didnt really work

I don’t think we can really figure out the problem without looking at the code. I’d recommend going back to an old version right before this issue started happening and trying to figure out whats causing it.

It could probably be some free model, if you used any. Just check scripts from a free model and if a free model has like too many instances i’d recommend trying to check it for any scripts using the pairs loop.

Ehh, it turned outto be a problem with the telephone, i had to go back a few versions. Anyway, heres the code that broke the game:

script.Parent.Changed:Connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Power.Value > 0 and script.Parent.Parent.Parent.Parent.Parent.FuseBox.Broken.Value == false then
script.Parent.Brightness = 0.7 + 0.3 * script.Parent.Parent.Parent.Parent.Parent.Power.Value
task.wait(5)
script.Parent.Brightness = 0.1
end
end)

You can fix this code with a simple debounce or by using script.Parent:GetPropertyChangedSignal(propertyName):Connect() for whatever property it is that you’re waiting to be changed. The reason why it crashes the server is because whenever you change script.Parent.Brightness, it fires script.Parent.Changed, which then instantly updates script.Parent.Brightness again which fires script.Parent.Changed another time before updating script.Parent.Brightness yet again and so on and so on infinitely until the server runs out of memory and crashes.

The reason why this also causes your ping to spike is because this telephone or whatever is being updated on the server. Whenever you change something on the server, the server needs to send a message to all the clients telling them that something has changed. In this case the server is telling all clients that script.Parent.Brightness is being updated dozens upon dozens of times per second, causing the network to be overloaded with data so much so that it slows down the communication between your client and the server.

great code bro! anyways, Parent.Parent.Parent.Parent.Parent.Parent

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.