Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStoreService = game:GetService("DataStoreService")
- local PointsStore = DataStoreService:GetDataStore("PointsStore")
- game.Players.PlayerAdded:Connect(function(Player)
- local SavedPoints = PointsStore:GetAsync(Player.UserId)
- local Leaderstats = Player:FindFirstChild("leaderstats") or Instance.new("Folder", Player)
- Leaderstats.Name = "leaderstats"
- local PointsValue = Leaderstats:FindFirstChild("Points") or Instance.new("IntValue", Leaderstats)
- PointsValue.Name = "Points"
- if SavedPoints ~= nil then
- PointsValue.Value = SavedPoints
- end
- PointsValue.Changed:Connect(function(NewPoints)
- PointsStore:SetAsync(Player.UserId, NewPoints)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement