of     1   

Jetskiis
#228331926Saturday, December 02, 2017 4:59 PM GMT

How do I merge this with a datastore so my leaderboard saves every time it changes? game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Kills" money.Value = 0 money.Parent = leaderstats local x= Instance.new("IntValue") x.Name= "Credits" x.Value=0 x.Parent=leaderstats end)
zackturbo52
#228332056Saturday, December 02, 2017 5:02 PM GMT

Use UpdateAsync For more info, check wiki below http://wiki.roblox.com/index.php?title=Data_store
1000knives
#228332175Saturday, December 02, 2017 5:06 PM GMT

money.Changed:connect(function(changedprop) if changedprop == "Value" then local valuestosave = money.Value UrDataStore:SetAsync(key, valuestoave) end end uh this should save the value after its changed, it will b throttled if the value changes too often R$18,322
Jetskiis
#228333521Saturday, December 02, 2017 5:41 PM GMT

b1
Jetskiis
#228353546Saturday, December 02, 2017 11:58 PM GMT

b2
LuaCymru
#228354446Sunday, December 03, 2017 12:17 AM GMT

I wouldn't do that, because the datastore can throttle. Save it when the player leaves the game.
Jetskiis
#228377717Sunday, December 03, 2017 1:50 PM GMT

b3
Jetskiis
#228384977Sunday, December 03, 2017 4:43 PM GMT

b4
Jetskiis
#228388341Sunday, December 03, 2017 5:51 PM GMT

bump
spinywind
#228388938Sunday, December 03, 2017 6:04 PM GMT

local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("Stats") game.Players.PlayerAdded:Connect(function(Player) local Data = DataStore:GetAsync(Player.UserId) local Leaderstats = Player:WaitForChild("leaderstats") if Data then for i,v in pairs(Data) do if Leaderstats[v[1]] then Leaderstats[v[1].Value = v[2] end; end; end; end); game.Players.PlayerRemoving:Connect(function(Player) local Leaderstats = Player:WaitForChild("leaderstats") local DataToSave = {} for i,v in pairs(Leaderstats:GetChildren()) do table.insert(DataToSave, {v.Name, v.Value}) end; DataStore:UpdateAsync(Player.UserId, function(Data) return DataToSave end; end);
spinywind
#228389208Sunday, December 03, 2017 6:09 PM GMT

Put that in a server script in ServerScriptService

    of     1