Game Keeps Crashing?

Hey, my game was working fine before and I didn’t change anything. After playing the game in a normal Roblox server, the game broke and no longer loads.

Problem: game does not load and it is stuck on this screen

Code snippet that causes it:

for _, item in pairs(equippedToSave) do --loads in equipped
	if item and allItems[item] and items:FindFirstChild(item) then
		local itemC = allItems[item]:Clone()
		itemC.Parent = equipped

I changed the datastore name and it actually ended up fixing it. So, the reason for this problem is the data that got saved

The equippedToSave variable is what you see in the output. It is just a list of all the items’ names you have equipped in the previous session. If you think that the cause of the problem is something else then I can provide more code. I think that this part is causing it because I commented everything else out and it worked fine until I reached this part.

1 Like


Did you test whether it is the snippet that causes it? Try disabling one script at a time and run. If problem persists, then I have no actual ideas.

Suspect some infinite loop, but I don’t think it is an infinite loop that runs far too fast, because it’ll break when running too fast.

On side of it, it looks like two prints were made before crashing.

I commented everything else out and I found out that this is the point where the problem occurs. I don’t think that it’s an infinite loop because in studio you usually get a popup that allows you to kill the script. The two prints were made because those were the only two items that I had on in the previous session.

Interesting, can you provide the code around it? Data stores should not be working(I think) in Studio from what I know when I’ve been testing.

Is the only issue the loading screen won’t go away? Or does you studio crash and create a lot of lag?
If the only issue is with the loading screen, couldn’t you remove it manually?

Also, what is the equipped variable?

1 Like

The character won’t spawn and Studio stops responding.

The equipped variable is what shows in the output. It is a table with the name of the items you have equipped.

Aren’t instances supposed to be parented to nil or other instances? Never seen an instance parented to a table.

It’s not parented.
I also ended up fixing the bug

You found a solution! That’s great! However, others that view this post will have no clue what that solution is, and saying “I fixed the bug” does not help. It would be greatly appreciated if you replied what you did to find the solution instead of posting a reply that explains nothing.

1 Like

The bug was just a logical thing so I don’t think anyone else could find this useful