Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStoreService = game:GetService("DataStoreService")
- local playerData = DataStoreService:GetDataStore("PlayerData")
- local function onPlayerJoin(Player)
- local BlackMarketThings = Instance.new("Folder")
- BlackMarketThings.Name = "BlackMarketThings"
- BlackMarketThings.Parent = Player
- local SpeedCheck = Instance.new("BoolValue")
- SpeedCheck.Name = "SpeedCheck"
- SpeedCheck.Parent = BlackMarketThings
- SpeedCheck.Value = false
- local HealthCheck = Instance.new("BoolValue")
- HealthCheck.Name = "HealthCheck"
- HealthCheck.Parent = BlackMarketThings
- HealthCheck.Value = false
- local playerUserId = "Player_ ".. Player.UserId
- local GetData
- local Success, Error = pcall(function()
- GetData = playerData:GetAsync(playerUserId)
- end)
- if Success and GetData then
- SpeedCheck.Value = GetData[1]
- else
- SpeedCheck.Value = false
- end
- end
- local function onPlayerLeave(Player)
- local success, err = pcall(function()
- local playerUserId = "Player_ "..Player.UserId
- local speedCheckValue = Player.BlackMarketThings.SpeedCheck
- playerData:SetAsync(playerUserId, {
- speedCheckValue.Value
- })
- end)
- if not success then
- warn("Could not save data, Error message: ", err)
- else
- print("Saved 2")
- end
- end
- game.Players.PlayerAdded:Connect(onPlayerJoin)
- game.Players.PlayerRemoving:Connect(onPlayerLeave)
Advertisement
Add Comment
Please, Sign In to add comment