local DS = game:GetService("DataStoreService"):GetDataStore("Data")
game.Players.PlayerAdded:Connect(function(plr)
local l = Instance.new("Folder")
l.Name "leaderstats"
l.Parent = plr
local v = Instance.new("IntValue")
v.Name = "Points"
v.Parent = 1
local file = DS:GetAsync(plr.UserId)
if file then
v.Value = file[1]
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync(plr.UserId,{plr.leaderstats.Points.Value})
end)
✓ ANSWER ACCEPTED
My script that I typed from ZingoDev does not work any help?
1 answer
✓ Accepted answer
The problem is that the v.Parent = 1 you put the number "1" insted of the letter "l" aka: L
Here a fixed version:
local DS = game:GetService("DataStoreService"):GetDataStore("Data")
game.Players.PlayerAdded:Connect(function(plr)
local fr = Instance.new("Folder")
fr.Name "leaderstats"
fr.Parent = plr
local v = Instance.new("IntValue")
v.Name = "Points"
v.Parent = fr
local file = DS:GetAsync(plr.UserId)
if file then
v.Value = file[1]
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync(plr.UserId,{plr.leaderstats.Points.Value})
end)
1 comment
0
or you could just change the "v.Parent = 1" part to "v.Parent = l"
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
What's the error/output
The leaderstats don't show up :/.