local DataStore2 = require(1936396537)
local defaultWins = 0
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
local WinsDataStore = DataStore2("WinsDataStore")
WinsDataStore.Parent = player
local PointsDataStore = DataStore2("PointsDataStore")
PointsDataStore.Parent = player
local varFolder = Instance.new("Folder")
varFolder.Parent = player
varFolder.Name = "vars"
local playerAlive = Instance.new("IntValue")
playerAlive.Parent = varFolder
playerAlive.Name = "playerAlive"
playerAlive.Value = 0
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
local wins = Instance.new("IntValue")
wins.Parent = leaderstats
wins.Name = "Wins"
local points = Instance.new("IntValue")
points.Parent = leaderstats
points.Name = "Points"
local function winsUpdate(value)
wins.Value = WinsDataStore:Get(value)
end
winsUpdate(defaultWins)
WinsDataStore:OnUpdate(winsUpdate)
local function pointsUpdate(value)
points.Value = PointsDataStore:Get(value)
end
pointsUpdate(0)
WinsDataStore:OnUpdate(pointsUpdate)
end)
Your issue was that you were using the “Parent” parameter of “Instance.new()”, it’s strongly advised that you shouldn’t use it & instead opt to set the “Parent” property explicitly as I did.