Um so im trying to make a datastore leaderstats script which creates a value in all players so when ever one players value is changes it is changed for all players. So i have like a gui and i want it to show total donations so im doing it this way, how do i make 1 leadertstat for all players? Heres what i have for the local player but not all players
Sorry for the bad explanation and English im tired lol
local dsService = game:GetService("DataStoreService")
local ds = dsService:GetDataStore("TotalDonations")
game.Players.PlayerAdded:Connect(function(plr)
local folder = plr
local currency = Instance.new("IntValue", folder)
currency.Name = "TotalDonations"
currency.Value = ds:GetAsync(plr.UserId) or 0
currency.Changed:Connect(function()
ds:SetAsync(plr.UserId, currency.Value)
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
ds:SetAsync(plr.UserId, plr.leaderstats.TotalDonations.Value)
end)

1 comment
no not that read the ACTUAL DESCRIPTION, one leaderstats for ALL PLAYERS!