I think i have a virus

So pretty much, after a couple of minutes, the game just freezes and you get disconnected, and i have NO idea why this happens?!?! I uninstalled all my plugins and i cant find any sort of virus inside the scripts.

Help me please…

2 Likes

And on studio it just freezes the game permanently

1 Like

It is very likely you have a loop in your game that doesn’t have a task.wait() before the code runs. I would check all of your loops including for loops like this

for i=1, 10000 do
--code
end
1 Like

Remember you cannot use renderstepped, stepped, or heartbeat without some form of wait time inside of the function(there are some exceptions to this but they are few and far between)

1 Like

i couldn’t find the virus, so i just reverted back to an old version and added the new items.

Also the game would freeze and then kick you for “No internet connection”

also maybe it wasnt even a virus but it was fixed

it’s really annoying because i have no idea where this is happening, is there a way to check the errors?

You would get a Script timeout: script exhausted allowed execution time error if it’s a script doing that. You could look for that in the Error Report on the Creator Dashboard.

1 Like

it’s how you scripted the game if all of the sudden everything froze with no virus roaming

im just assuming because memory leaks caused that weren’t properly cleaned, game logic may work as you expected it to work but putting it in where it’s unsafe or doing it without managing things can lead to another unexpected turn aswell

e.g what i meant with memory leak

--Memory 1037.MB (example)
--connecting anonymous event from another event or function

input_sv.InputBegan:Connect(function()
    event.Received:Connect(function() --where it happens
        --code
    end
end)

--oh no! the memory is increased by 146 megabytes now it has 1183.MB
1 Like

Is this occurring in the Roblox Player (live server), Roblox Studio game test, or just Roblox Studio itself? You weren’t really clear if this was happening in play mode or edit mode.

1 Like

It’s not going in the error report. And im forced to close studio when it happens.

In roblox studio, it freezes, and in player it just pauses the game and after a minute you get kicked for apparently, no internet connection, also happens to my friend

So Roblox Studio itself is misbehaving? Even outside of play/test mode? Have you tried seeing if it occurs on other Experiences (Team Create enabled and disabled) to try pinpointing the cause? You could also try reinstalling Roblox Studio itself if there’s issues outside of play mode.

1 Like

Open the profiler when you’re on the Player to see the memory usage and stats, this could help figure out if it’s a memory problem or a net problem too

1 Like

I am trying to find what is causing it, by reverting to an old version, then add stuff, like right now i am not crashing, but once i add something (dont know what), it does. So it’s a part of my code im assuming.

It’s probably an unresolved memory leak, under some circumstances these can be very hard to keep track of. Usually unresolved connections that are being created inside of either another connection or a loop. Think like creating a Tween every second and calling Connect on its Completed Event (inside of the loop) Make sure you’re using either Once (if it only occurs once) or using Disconnect.

2 Likes

I will look into it, also is it like a specific amount of MB before you crash?

I don’t think so. I’ve crashed or come close to crashing my studio plenty of times by accident with various scripts and the behavior is different everytime. Memory leaks will do that. I am sure you will find it if you keep looking

1 Like

Is there any way to know where its causing alot of memory leaks? Also is there a way to optimize videos?

1 Like

1000% there is. Disable the scripts inside of your game one by one until you’re able to play again without it crashing

1 Like

if you’re able to find the one causing it you can always send it here and we can help fix it

1 Like