Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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?

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. EpicMetatableMoment 1444 — 4y
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. aquathorn321 858 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

game:IsLoaded() vs ContentProvider:PreloadAsync

Hi, aquathorn321.

I have found some articles that might help you out from the Roblox wiki, you can view them here. I have never used these so, I don't know if this is what you're looking for but, I hope this helps you out.

EDIT: Preload has been deprecated so, use this link instead.

https://developer.roblox.com/en-us/api-reference/function/ContentProvider/PreloadAsync

Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

Answer this question