Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a way to have data loaded in before the game starts?

So I'm working on a survival game and every item or object with an interaction has an array that tracks extra behaviors, like custom objects. Is there any way I could have those arrays pre-loaded in studio instead of looping through any objects tagged as "CustomObject" under collection service and manually assigning them an array at game start?

2 comments

0

I do NOT suggest doing this. What is wrong with a loop? To continue, yeah, you could write some code that generates code that defines all of your references. You might see an issue if several objects have the same name.

0

Some objects might have more unique or complex metadata, and it would be tedious to hardcode a loading system for them. It would also save loading time when the server boots up. I can store objects under an Instance/value dictionary or assign them all their own Unique Universal Identifiers.

2 answers

Here is something, I have never messed around with this before but it could help you with what you need. Just not too sure if the data that is set during runtime will also save.

AssetService has a few methods to do with place > api interfacing. There is int64 CreatePlaceAsync(string placeName, int64 templatePlaceID, string description) which allows the creation of new places within a game and also there is void SavePlaceAsync() which allows saving of the current place. I am not entirely sure this will work during runtime and what security level this runs at. However, you could always give it a try.

Hope this helps!

This discussion is preserved as it was. New answers, comments, and votes are closed.