Freezing When Teleporting Between Places

My players and I have encountered a very annoying bug that has likely been the culprit for dwindling players in the Matchmaking portion of my game.

When teleporting from the starting place to the Matchmaking place in particular, the game tends to “freeze” and take AGES (or sometimes never) to actually load. This comes in the form of a solid black screen due to a “fade to black” script I have.

This tends to only occur in Public servers that have been active for quite some time, and not private servers (private servers tend to be instant when teleporting between places).

While this bug is occurring, the CoreGui’s are completely absent, and the cursor disappears (as shown in the video). I believe it just takes the last frame before the freeze and sticks to it.

Here’s my code for the teleporting.

script.Parent.Interact.Proximity.Triggered:Connect(function(plr)
		game.ReplicatedStorage.RepStoragePack.ClientFade:FireClient(plr,10)
		game:GetService("TeleportService"):TeleportAsync(13389008142,{plr})
end)

Here’s my code for the “fade to black” effect activated by the FireClient function.

game.ReplicatedStorage.RepStoragePack.ClientFade.OnClientEvent:Connect(function(duration)
	script.Parent.Frame.Visible = true
	script.Parent.Frame.BackgroundTransparency = 1
	game:GetService("TweenService"):Create(script.Parent.Frame,TweenInfo.new(.5),{BackgroundTransparency = 0}):Play()	
	task.spawn(function()
		wait(.2)		game:GetService("TweenService"):Create(game.SoundService.SFX.SkillTreeMuffle,TweenInfo.new(.35),{HighGain = -40,LowGain = -40,MidGain = -40}):Play()
	end)
	wait(.5)
	wait(duration)
 game:GetService("TweenService"):Create(game.SoundService.SFX.SkillTreeMuffle,TweenInfo.new(.5),{HighGain = 0,LowGain = 0,MidGain = 0}):Play()
	game:GetService("TweenService"):Create(script.Parent.Frame,TweenInfo.new(.5),{BackgroundTransparency = 1}):Play()
	wait(.5)
	script.Parent.Frame.Visible = false
end)

Any help?

2 Likes

This is what it looks like in a private server, notice how it is MUCH faster and responsive.

1 Like

Although it is difficult to determine exactly what is causing your game to freeze, it could be an issue with memory leaks. If your game’s code contains memory leaks, which build up over time, it slowly degrades the performance of your game. If this is the case, it could explain why a new server with just you in it had a significantly better performance than a public server with multiple people in it that had been running for hours. However, there is a possibility something else could be causing this problem; memory leaks are only one thing to consider and there is a possibility that this is not the reason why your game is freezing.

The first thing I would recommend in order to pinpoint the issue is accessing the performance statistics in the developer console (accessible by pressing F9) and comparing the statistics between a private server and some public servers, especially those that had been running for a long time. In addition, keep note if any performance stats heavily change while you use the matchmaking system, and if these performance stats change significantly more in a public server than a private server.

Also, has this performance issue always occurred? Was the matchmaking system recently reworked, or has the performance of your matchmaking system remained the same for a long time until recently? This information will make it easier to pinpoint the cause behind this issue.

1 Like

I have found the issue to be caused by a memory leak resulting from ObjectValues never being added to Debris in my Sound Scripts.

Thank you Friendly4Crafter for guiding me to memory leaks as the root cause (marked their post as the solution), as I’d likely never found this if this reply wasn’t made.

I found the ObjectValues from a code snippet that counted the number of Instances occupying Memory based on ClassName. Object Values tended to be the majority of all instances in old servers.

1 Like

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