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:GetAsync(player.UserId.."-stage")
end)
if success then
if data then
player.Team = game.Teams[data]
else
player.Team = game.Teams.Stage1
end
player.Team = game.Teams.Stage1
end
game.Players.PlayerRemoving:Connect(function(player)
local teamName = player.Team
local success, errorMessage = pcall(function()
DataStore:SetAsync(player.UserId.."-stage",teamName)
end)
if success then
print("All Went Well")
else
print(errorMessage)
end
end)
thats the data store script i got from alvin