local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("ObbyDataStore")
game.Players.PlayerAdded:Connect(function(player)
local data
local success, errorMessage = pcall(function()
data = DataStore:SetAsync(player.UserId.."-stage")
end)
if success then
print("Success")
if data then
player.Team = game.Teams[data]
else
player.Team = game.Teams.Lobby
end
else
print(errorMessage)
player.Team = game.Teams.Lobby
end
player:LoadCharacter()
end)
game.Players.PlayerRemoving:Connect(function(player)
local teamName = player.Team.Name
local success, errorMessage = pcall(function()
DataStore:SetAsync(player.UserId.."-stage",teamName)
end)
if success then
print("All went well")
else
print(errorMessage)
end
end)
I followed this tutorial to save spawnpoints in my obby game but it does not work. Does anyone know why?
There are no errors in the output.
