I am not good with datastores and I wondered how to use datastores between two places. I need to make a system which if player buy a skill, bool value change to true in other place. It is possible if it is how?
1 Like
Yeah it actually is, just be sure to use your GetAsync/SetAsync functions properly, use your same BoolValues that you wanna load, have the same names when using the GetDataStore function and it should replicate across both places
local DataStore = game:GetService("DataStoreService")
local DataName = DataStore:GetDataStore("RandomNameHere")
game.Players.PlayerAdded:Connect(function(Player)
local RandomBool = Instance.new("BoolValue")
RandomBool.Name = "BoolToSave"
RandomBool.Parent = Player
local Data
local success, whoops = pcall(function()
Data:GetAsync(Player.UserId)
end)
if success and Data then
RandomBool.Value = Data.Bool
end
end)
1 Like
It looks like solution. Thank you so much for help.
It is only if the two places are under the same Universe, otherwise you will need to directly use the GamePersistence API or an External Database.
Both in same universe. Thanks for this information too.