Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TeleportService = game:GetService("TeleportService")
- local scrappedContentDataStore = game:GetService("DataStoreService"):GetDataStore("scrappedContent")
- local stringValue = ""
- game.Players.PlayerAdded:Connect(function(player)
- local scrappedContentValue = Instance.new("StringValue", player)
- scrappedContentValue.Name = "ScrappedContent"
- local success, Data = pcall(function()
- return scrappedContentDataStore:GetAsync(player.UserId)
- end)
- if success and Data then
- scrappedContentValue.Value = Data.ScrappedContent or ""
- else
- scrappedContentValue.Value = stringValue
- end
- end)
- game.Players.PlayerRemoving:Connect(function(player)
- local scrappedContentValue = player:FindFirstChild("ScrappedContent")
- if scrappedContentValue then
- pcall(function()
- scrappedContentDataStore:SetAsync(player.UserId, {
- ScrappedContent = scrappedContentValue.Value
- })
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment