i made a obby save script with a table but the server says that it saves when you leave but when you join it does not load your data but there is no errors showing.
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("MyDataStore")
game.Players.PlayerAdded:Connect(function(player)
local ack = Instance.new("Folder")
ack.Name = "leaderstats"
ack.Parent = player
local ack2 = Instance.new("IntValue")
ack2.Name = "Stage"
ack2.Parent = ack
local data
local success, errormassage = pcall(function()
data = DataStore:SetAsync(player.UserId.."-stage")
end)
if success then
ack2 = data
else
print("there was an error whilst getting your data")
warn(errormassage)
end
local test = player.leaderstats.Stage.Value
end)
function oa(object)
wait()
local player = game.Players:playerFromCharacter(object)
if player ~= nil then
local ls = player.leaderstats
local sl = game.Workspace:FindFirstChild(ls.Stage.Value)
print("gah")
object.Torso.CFrame = object.Torso.CFrame + Vector3.new(0,3,0)
if sl ~= nil then
object.Torso.CFrame = sl.CFrame + Vector3.new(0,3,0)
end
end
end
game.Workspace.ChildAdded:connect(oa)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
DataStore:SetAsync(player.UserId.."-stage",player.leaderstats.Stage.Value)
end)
if success then
print("Player Data successfully saved!")
else
print("there was an error when saving data")
warn(errormessage)
end
end)

2 comments
hmm... nothing at all is printed? try putting a print() statement at the beginning of the PlayerRemoving function
it prints that it has saved but it does not when loading the save