Async in methods

So I know that the word async appears after many functions. The most popular are the data stores. But here are all the methods that have -async after them.

DataStore:UpdateAsync()
DataStore:SetAsync()
DataStore:IncrementAsync()
DataStore:GetAsync()
DataStore:RemoveAsync()
PolicyService:GetPolicyInfoForPlayerAsync()
Path:ComputeAsync()
Player:RequestStreamAroundAsync()
HttpService:RequestAsync()
HttpService:GetAsync()
ContentProvider:PreloadAsync()
BasePart:UnionAsync()
HttpService:PostAsync()
Players:GetFriendsAsync()
GroupService:GetAlliesAsync()
TeleportService:TeleportPartyAsync()
MarketplaceService:GetDeveloperProductsAsync()
TextService:FilterStringAsync()

These are all the methods that come off of the top of my head, but I noticed it would be much more straightforward if say, you did this:

DataStore:Set(player.UserId, value)

I know there is a reason for the async. I suspect each method with async links to something external. I know group service and http service are linked to the website. But that does not explain things like :ComputeAsync because that is a method of the pathfinding class and that is within the roblox engine.

Because it is an asynchronous operation.

So basically a yielding function like Instance:WaitForChild()?

What I believe Async is is a method of telling you that you are saving something or getting something. Almost all of them also uses external resources(that are not from the game), such as:

DataStore:UpdateAsync()
DataStore:SetAsync()
DataStore:IncrementAsync()
DataStore:GetAsync()
DataStore:RemoveAsync()

They use Robloxes DataStore.

So basically these functions return void?

Yeah, they’re yielding functions. Unlike WaitForChild, though, it might not be immediately obvious that they yield, since their main purpose isn’t really to yield. That’s why they put Async in the name.

2 Likes