(1) Problem: Datastore leaderboard duplicates money when a player joins and leaves quickly What I am trying to accomplish: A solution to the problem above ^
Script:
local datastore = game:GetService("DataStoreService")
local ds2 = datastore:GetDataStore("BankSaveSystem")
game.Players.PlayerAdded:connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "stats"
local wallet = Instance.new("IntValue", folder)
wallet.Name = "Wallet"
local bank = Instance.new("IntValue", folder)
bank.Name = "Bank"
wallet.Value = 0
bank.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsync(plr.UserId, bank.Value)
bank.Changed:connect(function()
wait(0.5)
ds2:SetAsync(plr.UserId, bank.Value)
end)
end)
(2) Problem: ".Changed" Event is not working with Number/IntValue What I want: For it to actually work and update the text.
game.Players.LocalPlayer.stats.Bank.Changed:Connect(function()
script.Parent.BankAmount.Text = fBank
dddddddd
game.Players.LocalPlayer.stats.Wallet.Changed:connect(function()
script.Parent.WalletAmount.Text = fWallet
end)
AND this doesn't work either
game.Players.LocalPlayer.stats.Bank.Value.Changed:Connect(function()
script.Parent.BankAmount.Text = fBank
end)
game.Players.LocalPlayer.stats.Wallet.Value.Changed:connect(function()
script.Parent.WalletAmount.Text = fWallet
end)

3 comments
bump
Is this in a ls?
Define "ls" please