How to create a DataStore | Roblox Forum
Welcome to the Forums!
Join thousands of other Roblox members with a free account.
Create Forum Account

How to create a DataStore

  • This website was created by Roblox members to replace the official forums because Roblox shut them down! Join our community if you like to talk about Roblox!

sk3tchDavid

New Member
Aug 2, 2020
1
0
0
Roblox
sk3tch_david
I woud like to save leaderstats, Items, etc. in My game.
I have already Leaderstats and Items but i cant make a DataStore.
also i have aready tried this: https://developer.roblox.com/en-us/articles/Data-store
But when i leave the game and rejoin, everythink was like at the beginning.
How can i resolve this problem ?
Thanks! 😃

Here are my leaderstats:

Code:
game.Players.PlayerAdded:Connect(function(player)

local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player

local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Value = 4
coins.Parent = leaderstats
end)
 

Trust

New Member
Apr 27, 2019
26
0
1
Roblox
TrustRequiem
Discord
Trust#7538
Are you sure you followed the tutorial correctly? You're not even attempting to save anything, you're just creating a value, and changing that value..

You firstly need to grab the DataStore service:

Code:
local dataStore = game:GetService("DataStoreService")
Then you can get that data:
Code:
local coinsData = dataStore:GetDataStore("Coins")
You can use use GetAsync and SetAsync to load and save data.
 
General
Help Users
    Thecoolguy16183 Thecoolguy16183: hey @Vipnoob07 i added you on roblox friend me its thecoolguy16183