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

how do i make a save function where the thing i need to save is whether a part is black or red?

Asked by 6 years ago

hi, im trying to make a save function for my game, the thing that needs to be saved is if a block is black or red, please only answer this question if you are 100% sure on the answer as i dont really need to know the answer to this because there are only 50 things to collect

thanks from poopypigeon245

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
6 years ago
Edited 6 years ago

You can use DataStores.

Steps:

  • Define the datastore with the GetDataStore function of DataStoreService

  • Save to the datastore using SetAsync ~ provide a key to retrieve the value, and the value to save.

  • Load from the datastore using GetAsync ~ provide the key that holds the desired value

--Define datastore
local ds = game:GetService("DataStoreService"):GetDataStore("Part")

--Save to datastore
ds:SetAsync("Color",workspace.Part.BrickColor)

--Load from datastore later using
ds:GetAsync("Color");
Ad

Answer this question