Three Questions:
1: Am I able to use DataStore2.Combine more than once? if so how is that benefitable?
2: Is there a way to make a stat that is already in existence, instead of making an instance?
3: Is there a way to assign a dataStore to a Value that is inside a UI element, but that element is cloned many times, like an Upgrade system that has a “CurrentUpgrade” value inside the UI, And I don’t want my datastore to interfere with other instances of the “CurrentUpgarde”?
local Players = game:GetService("Players")
local DS2 = require(game.ServerScriptService.DataStore2)
DS2.Combine("DATA","Element","HasPillar")
Players.PlayerAdded:Connect(function(Player)
local ElementStore = DS2("ElementS",Player)
local HasPillarStore = DS2("HasPillar",Player)
local DataFolder = Instance.new("Folder")
DataFolder.Name = "Data"
local Element = Instance.new("StringValue")
Element.Name = "Element"
Element.Parent = DataFolder
Element.Value = ElementStore:Get("Fire")
ElementStore:OnUpdate(function(newVal)
Element.Value = newVal
end)
local HasPillar = Instance.new("BoolValue")
HasPillar.Name = "HasPillar"
HasPillar.Parent = DataFolder
HasPillarStore.Value = HasPillarStore:Get(false)
HasPillarStore:OnUpdate(function(newVal)
HasPillar.Value = newVal
end)
DataFolder.Parent = Player
end)
game.Players.PlayerAdded:Connect(function(Player)
local joinData = Player:GetJoinData()
local teleportData = joinData.TeleportData
if teleportData then
if teleportData.Won then
repeat wait() until Player.Character
local c = Player.Character
local DS2 = require(game.ServerScriptService.DataStore2)
local HasPillarStore = DS2("HasPillar",Player)
print("Newest")
HasPillarStore:Set(true)
c:WaitForChild("HumanoidRootPart").CFrame = workspace.NPCs["vShanksv"].Spawn.CFrame
elseif teleportData.Won == false then
repeat wait() until Player.Character
local c = Player.Character
c:WaitForChild("HumanoidRootPart").CFrame = workspace.NPCs["vShanksv"].Spawn.CFrame
end
end
end)
its printing so i know it reached but it doesnt work
Can you use two separate tables for DataStore2? My game uses a save system where players’ statistics/preferences (e.g. coins, UI Size, Music Volume) and their inventory (all the tools they own) are separated, as I keep adding new entries to both tables through updates, making a unification of both very displeasing to deal with, as it would mean I’d have to reflush all entries in my system every time I want to add something to one of the two tables.
Thanks in advance
can you use it in local script too? like getting the number or string i guess not but you can create a folder with every properties but in numbervalue or in stringvalue
When I looked on the Saving Methods on the GitHub Page, It said that the saving method is Ordered Backups by default, does that mean it is kind of the same as DataStoreService:GetOrderedDataStore("GlobalLeaderboard_" .. statsName)
or is Ordered Backups Completely different, if it is completely Different, how am I able to make a ordered list of the dataFrom all the players?
I’m having a problem, it doesn’t seem to be saving the data correcty ( I use DataStore(“CustomInfo”,plr):Set(table) print(DataStore2(“CustomInfo”,plr):Get() and it does print the correct data, however when I rejoin, it prints a random data that I’ve never saved? Thank you for reading.
Currently having trouble, could I get some help? It seems that whenever I save the data I can’t get the data again from a place inside of the game. I use the same key and yet I’m still having trouble. Is there anything I’m missing?