Title basically says it all. How can I fix that problem. is there to much saving, or something else?
Here is my script:
local Players = game:GetService("Players")
local ServerScriptService = game:GetService("ServerScriptService")
local DataStore2 = require(ServerScriptService.DataStore2)
-- Combine every key you use. This will eventually be the default, but for now read the "Gotchas" section to understand why we need this.
DataStore2.Combine("DATA", "points" , "rubys" , "playTime" , "deaths" , "kills", "Wins")
Players.PlayerAdded:Connect(function(player)
-- get players data
local pointsStore = DataStore2("points", player)
local rubysStore = DataStore2("rubys", player)
local playTimeStore = DataStore2("playTime", player)
local deathsStore = DataStore2("deaths", player)
local killsStore = DataStore2("kills", player)
local winsStore = DataStore2("Wins", player)
-- instance into player's data
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local points = Instance.new("NumberValue")
points.Name = "Points"
points.Value = pointsStore:Get(0) -- The "0" means that by default, they'll have 0 points
points.Parent = leaderstats
local Rubys = Instance.new("IntValue")
Rubys.Name = "Rubys"
Rubys.Value = rubysStore:Get(0)
Rubys.Parent = leaderstats
local playTime = Instance.new("IntValue")
playTime.Name = "playTime"
playTime.Value = playTimeStore:Get(0)
playTime.Parent = leaderstats
local Deaths = Instance.new("IntValue")
Deaths.Name = "Deaths"
Deaths.Parent = leaderstats
local Kills = Instance.new("IntValue")
Kills.Name = "Kills"
Kills.Value = killsStore:Get(0)
Kills.Parent = leaderstats
local roundKills = Instance.new("IntValue", player)
roundKills.Name = "RoundKills"
local Wins = Instance.new("IntValue", leaderstats)
Wins.Value = winsStore:Get(0)
Wins.Name = "Wins"
-- Set the values Data, if the player has any
pointsStore:OnUpdate(function(newPoints)
-- This function runs every time the value inside the data store changes.
points.Value = newPoints
end)
rubysStore:OnUpdate(function(newRubys)
Rubys.Value = newRubys
end)
playTimeStore:OnUpdate(function(myplayTime)
Rubys.Value = myplayTime
end)
deathsStore:OnUpdate(function(newDeaths)
Rubys.Value = newDeaths
end)
killsStore:OnUpdate(function(newKills)
Rubys.Value = newKills
end)
winsStore:OnUpdate(function(newWins)
Rubys.Value = newWins
end)
leaderstats.Parent = player
end)
Help soon,