Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStore = game:GetService("DataStoreService")
- local Toturial = DataStore:GetDataStore("testJoins")
- game.Players.PlayerAdded:Connect(function(player)
- local ToturialFolder = Instance.new("Folder",player); ToturialFolder.Name = "ToturialFolder"
- local ArrowToPink = Instance.new("BoolValue",ToturialFolder); ArrowToPink.Name = "PinkArrow"
- local PlayerUserId = "Player_"..player.UserId
- --Load Data
- local data
- local success, errormessage = pcall(function()
- data = Toturial:GetAsync(PlayerUserId)
- end)
- if success then
- if data then
- ArrowToPink.Value = data.ArrowToPink
- end
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local PlayerUserId = "Player_"..player.UserId
- local data = {
- ArrowToPink = player.ToturialFolder.PinkArrow.Value;
- }
- local success, errormessage = pcall(function()
- Toturial:SetAsync(PlayerUserId, data)
- end)
- if success then
- print("Toturial Stuff saved:)")
- else
- print("There was an error!")
- warn(errormessage)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement