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

What are datastores and what do they do?

Asked by 6 years ago

What is a datastore and how do i use it and is it needed for a game? Please help!

0
googling that is so hard wow lucldIy 3 — 6y

1 answer

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

A datastore is what you use to save things. Example; Say I want to save levels in a game I'd first create a folder and parent it to something. Then I'd create an instance.new of a intvalue for the level and put it inside the folder. Here's an example that would load on join and save on leave.

01local player = game:GetService("Players")
02local SS = game:GetService("ReplicatedStorage")
03local DS = game:GetService("DataStoreService")
04 
05-- Creating the local Data makes a new table for the data to go into
06 
07local data = {
08["Level"] = DS: GetDataStore("Level")
09}
10 
11player.PlayerAdded:connect(function(plr) -- Function to see a player join
12 
13local success, err = pcall (function() -- pcall to secure the data
14local userID = plr.userId
15 
View all 33 lines...

Hoped this made sense or helped, I'm kind of new to scripting too

0
Thank you so much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! turquoise_monkeyman 32 — 6y
0
Will it work with cash! turquoise_monkeyman 32 — 6y
0
It works with any Stringvalues, and IntValues DesiredRep 75 — 6y
0
stats is depreceated turquoise_monkeyman 32 — 6y
View all comments (7 more)
0
Desired #2084 add me and DM me your script DesiredRep 75 — 6y
0
The script dosent work turquoise_monkeyman 32 — 6y
0
yes it does i even tested it DesiredRep 75 — 6y
0
ok ill check once more turquoise_monkeyman 32 — 6y
0
Where does a datastore go turquoise_monkeyman 32 — 6y
0
I put it in the workspace!!!! turquoise_monkeyman 32 — 6y
0
serverscriptservice DesiredRep 75 — 6y
Ad

Answer this question