Say I had OrderedDataStore A, in this code:
local A = game:GetService("DataStoreService"):GetOrderedDataStore("Group Troopers") --Creates my new DataStore game.Players.PlayerAdded:connect(function (Player) if not A:GetAsync(Player.Name) then A:SetAsync(Player.Name, [CURRENT TOP NUMBER + 1]) end end)
(Assume that I went in the console and made a placeholder with value 0, so that would be the greatest number in the store.)
Where I have [CURRENT TOP NUMBER + 1], I want to script it so that the script will search through the datastore for the HIGHEST NUMBER, then add 1 to it for the new trooper number. How can I go about this?
Thanks in advance, SquirrelOnToast