I keep getting a strange error in the console which appears to be causing huge amounts of lag

This has been happening for almost a year, I’ve searched through all my scripts and found nothing malicious. Almost every script in the game is mine, which Is why I’m even more confused. Here is an explanation of what happens: After about 20 minutes of server time, if someone joins the game, then everyone freezes in place and nobody can chat. The player can still move, but it appears everyone else is frozen. I have noticed a pattern of this happening when one of my friends joins, but I can’t be too sure. I’ve never noticed the error until today, here is the error:


I can’t guarantee you that this whats causing the lag, because like I said, I normally have a clear console besides the occasional function error. The error for that is this:
image
I’ve had my game for many years now, and I’ve had so many memories there. I’d hate to have it ruined just like that. Any help is appreciated. Have a great day, and stay healthy! :slight_smile:

Discord: happyhal75#2503

4 Likes

can you show us the script named ontouch?

Also, that strange warns appeared in many games whitch is making games crash/lag. I think there are arleady bug raports about this.

This has been going on for years, but sure. Here’s the script with the error.

function ontouch(hit)
	 if game.Players:GetPlayerFromCharacter(hit.Parent) then
		hit.Parent.Humanoid.Sit = true
	end
end
script.Parent.Touched:Connect(ontouch)

I should also mention that the full output consists of the ontouch script error being repeated many times.

1 Like

Simply, change the script into this:

function ontouch(hit)
	 if game.Players:GetPlayerFromCharacter(hit.Parent) then
        local Humanoid = hit.Parent:FindFirstChild("Humanoid")
        if Humanoid then
		Humanoid.Sit = true
        end
	end
end
script.Parent.Touched:Connect(ontouch)
1 Like

Do you really think this would cause the entire game to lag when someone joins?

1 Like

This isn’t doing the game to stop lagging/crashing, this is only doing that error to be solved.

Oof, well this does bring me one step closer. But this simple thing won’t cause the entire game to be normal. I’m trying my best to not get disappointed over this, but I really don’t know what else to do.

I think you should wait a engineer to repair this or do a bug raport yourself.

It happen me when i enter develop console in my own game, lag and crash. If you add loop 100% Crash

That isn’t what I’m saying. What I’m saying is that whenever someone joins my game after like 30 minutes, nobody can chat or move.

ohh that lag. You spot players like they teleport when they walking around.

Chat Freezes and everyone APPEARS to freeze?
So you don’t see them update location, but on their game they can still move?

you have two errors in the first picture
an ‘unhandled rejection’ in

CorePackages.AppTempCommon.LuaChat.Utils.getFriendsActiveGamesPlaceIdsFromUsersPresence

and

CorePackages.Packages._Index.roblox_roact.roact.createReconciler:229 function updateVirtualNode

Is this happening to others or just you?

It happens to everyone in the game. I haven’t noticed this in any other games, if that’s what you meant.

So game runs for 30min

someone joins (anyone)

everyone can still run, but sees everyone else standing still and no chat available?

Pretty much, also 30 minutes is just an estimate, it varies. After this happens, the server is done and it usually crashes after about 10 minutes of that strange lag phase

I think I know why it crashes and gets lag, you have not made a debounce, basically, when the player touches the part that makes him sit, he touched it again and again and again, and it does not stop. The script runs for too many times too fast, if you add a debounce I am pretty sure it will get fixed.

Which script are you referring to?

Oh wait, I think I did not notice something, you said when the player joins the game? and not touches the brick?

Yes, it has a pattern of causing the lag when someone joins.