Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Money Duplicating + .Changed not working?

Asked by
NewGPU 36
5 years ago
Edited 5 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

(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)
0
bump NewGPU 36 — 5y
0
Is this in a ls? danglt 185 — 5y
0
Define "ls" please NewGPU 36 — 5y

Answer this question