Help making a datastore

I’ve been trying to find tutorials on how to make a datastore but I’m not sure how to fit it into my scripts. Any help is very appreciated

local DataStoreService = game:GetService("DataStoreService")

local statsStore = DataStoreService:GetOrderedDataStore("SlayerStats")





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

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

	local Strength = Instance.new("IntValue")
	Strength.Name = "Strength"
	Strength.Value = 0
	Strength.Parent = data
	
	local def = Instance.new("IntValue")
	def.Name = "Defense"
	def.Value = 0
	def.Parent = data
	
	local br = Instance.new("IntValue")
	br.Name = "Breathing Level"
	br.Value = 0
	br.Parent = data

	local lastname = Instance.new("StringValue")
	lastname.Name = "Bloodline"
	lastname.Value = "Bumbalough"
	lastname.Parent = data
	
	local Rank = Instance.new("StringValue")
	Rank.Name = "Rank"
	Rank.Value = "None"
	Rank.Parent = data
	
	local Race = Instance.new("StringValue")
	Race.Name = "Race"
	Race.Value = "Human"
	Race.Parent = data
	

end)

1 Like

here’s a guide from the roblox documents
also if you’re looking to make a normal data store i recommend using DataStoreService:GetDataStore()
since ordered data stores are for leaderboards

2 Likes

Thank you! This was really helpful and I was able to get it to work ^^