local New = Instance.new("Folder", Player)
New.Name = "PlayerRank"
local Old = Instance.new("IntValue", New)
Old.Name = "RankPoints"
local Rank = Instance.new("StringValue", New)
Rank.Name = "RankName"
local MaxRankPoints = Instance.new("IntValue", New)
MaxRankPoints.Name = "MaxRankPoints"
local success,data = pcall(function()
return Data:GetAsync(Player.UserId)
end)
if data then
print("Data :P")
Rank.Value = data[1]
Old.Value = data[2]
MaxRankPoints.Value = data[3]
elseif not data then
print("No Data")
MaxRankPoints.Value = 100
Rank.Value = "Cadet"
Old.Value = 0
end
end)
Players.PlayerRemoving:Connect(function(Player)
local WillReturn = {}
for i,v in ipairs(Player["PlayerRank"]:GetChildren()) do
if v.Name == "RankName" then
table.insert(WillReturn, 1, v.Value)
end
if v.Name == "RankPoints" then
table.insert(WillReturn,2, v.Value)
end
if v.Name == "MaxRankPoints" then
table.insert(WillReturn,3, v.Value)
end
end
Data:SetAsync(Player.UserId, WillReturn)
print("SHOULD SAVE OMG")
end)
Look like it’s not saving correctly, I don’t know why, it should save, but it’s printing “No Data”