I’m using DataStore2 the first time, and this code doesn’t save ‘Money’ while it successfully saves ‘Wins’
I’m really confused because I searched every single places on Google and I still don’t know the answer.
I want ‘Money’ to be saved as well as ‘Wins’.
My code is as the following :
local DataStore2 = require(script.DataStore2)
DataStore2.Combine('data', 'money', 'wins')
Players.PlayerAdded:Connect(function(plr)
local moneyStore = DataStore2('money', plr)
local winsStore = DataStore2('wins', plr)
local leaderstats:Folder = Instance.new('Folder', plr)
leaderstats.Name = 'leaderstats'
local wins = Instance.new('IntValue', leaderstats)
wins.Name = 'Wins'
wins.Value = winsStore:Get(0)
wins:GetPropertyChangedSignal('Value'):Connect(function()
winsStore:Set(wins.Value)
end)
local money = Instance.new('IntValue', leaderstats)
money.Name = 'Money'
money.Value = moneyStore:Get(0)
money:GetPropertyChangedSignal('Value'):Connect(function()
--print(money.Value)
moneyStore:Set(money.Value)
--print(moneyStore:Get(0))
end)
end)