Folder inside game gets deleted when restarting studio

Hey there, I have a folder that stores some module scripts inside it. This folder is based on the game, that I have created with Instance.new(“Folder”, game), why does the folder get deleted and is there any way around this?

Why specifically do you need to parent it to game? Can’t you parent it to Replicated Storage or something else? That could be your problem, though I haven’t tested. Also, using the second argument of Instance.new is frowned upon because it’s slower.
Use this instead:

local folder = Instance.new("Folder")
folder.Parent = game:GetService("ReplicatedStorage")

I hope this helps!

I don’t mind it being slower, a millisecond of a creation of a folder doesn’t affect me, I just want to know why it can’t be saved in the game?

the Game itself is exclusively for storing services, iirc.

My folder is a custom service, do you know the reason it doesn’t save?

Why are you parenting it to the WorldModel? Just parent it under any services available in your explorer tab.

You can’t make a folder as a custom Roblox service.

If you want to create a custom service, check this out:

I’m not asking how to make a custom service, my question was why doesn’t the folder save.

In what context? What are you trying to achieve? Are you asking why the folder instance cannot be saved when parented under WorldModel?

Yes, why doesn’t my folder save under the WorldModel?

I have no idea how to explain it, but DataModel (not WorldModel my mistake.) is designed to only store valid Roblox services under it. So anything that is not a service will be deleted by it.

Also, why are you trying to do so anyway?

1 Like

Thank you, that was a good enough explanation

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