game.Players.PlayerAdded:Connect(function(player)
local Folder = Instance.new("Folder")
local Position = Instance.new("StringValue")
Folder.Name = "Positions"
Folder.Parent = player
Position.Parent = Folder
Position.Name = "Position"
local data
local success, errormessage = pcall(function()
data = MyDataStore:GetAsync(player.UserId.."-Pos")
end)
if success then
warn(data)
Position.Value = data
else
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
MyDataStore:SetAsync(player.UserId.."-Pos", player.Positions.Position.Value)
end)
if success then
warn("cool")
else
warn(errormessage)
end
end)
Why does this thread exist
you already made one